title: How to make document ready conditional using AngularJS?
body: <p>I'm using ASP.NET MVC and AngularJS as my framework. I've a link which send request to MCV Action and finally gets forwarded to view.  This view has registered JavaScript File which loads angular.element(document).ready(function (e){} function. Basically I'm trying to create a if else statement inside angular.element(document).ready. based on myparam=true. How can I do it?</p>
  <p>Link -</p>
  <pre><code>&quot;&lt;h7&gt;&quot; + &quot;&quot; + &quot;&lt;a target=\&quot;_blank\&quot; href='/Submission/EditSubmissionFile?id=&quot; + SubmissionID + &quot;&amp;myparam=true&quot; +&quot;'&gt;&quot; + &quot;Add Attachment&quot; + &quot;&lt;/a&gt;&lt;br&gt;&lt;/h7&gt;&quot; +
  </code></pre>
  <p>AngularJS Javascript File -</p>
  <pre><code>mainApp.controller('editSubmissionFileController', ['$scope', '$location', '$http', 'viewDataService', 'utilityService', '$window', 'constants', '$timeout', 'constants', 'adComplianceUtility', 'submissionRuleService',
      function ($scope, $location, $http, viewDataService, utilityService, $window, constants, $timeout, constants, adComplianceUtility, submissionRuleService) {
          
          angular.element(document).ready(function (e) {
          
          // How to make this conditional based on parameter passed from Action or html link? 
  
          $scope.$broadcast('ShowFileUpload', {
              SubmissionID: $scope.model.data.SubmissionID,
              Show: true,
              Callback: function (data) {
                  $scope.onFileUploadSuccessful(data);
              }
          })
      });
  }
  </code></pre>
  <p>Action -</p>
  <pre><code>public ActionResult EditSubmissionFile(int id)
          {
              // We can only see what we are allowed
              UserContext.TestSubmissionExists(id);
              UserContext.TestSubmissionAccess(id, AccessRightEnum.ViewSubmissions);
  
              var model = _submissionSvc.GetSubmissionViewModel(id);
  
              return View(&quot;EditSubmissionFile&quot;, model);
          }
  </code></pre>