title: Getting Angular scope method for dynamically loaded element
body: <pre><code>&lt;div id=&quot;Some-div&quot; data-ng-controller=&quot;SomeController&quot;&gt;
  &lt;/div&gt;
  
  angularModule.controller(&quot;SomeController&quot;, [&quot;$scope&quot;, &quot;$http&quot;, function ($scope, $http) {
      $scope.someFunction = function myfunction() {
  
      }    
  }]);
  </code></pre>
  <p>When we use<code>getAngularControllerScope($('#Some-div'));</code> to get the scope the method <code>someFunction()</code> is accessible and can be called like this <code>getAngularControllerScope($('#Some-div')).someFunction()</code></p>
  <h2>But when the same div is loaded through an ajax call</h2>
  <p><code>getAngularControllerScope($('#Some-div'));</code> has no methods available.
  Please help.</p>
  <h3>Loading of the html</h3>
  <pre><code>$http.post('/SomeController/MyPartialAction', { data: &quot;value&quot; }).success(function (response) {
  //load the partial view HTML in the div
  $(&quot;#MyDiv&quot;).html(response);        
  });
  </code></pre>