<div id="Some-div" data-ng-controller="SomeController">
</div>
angularModule.controller("SomeController", ["$scope", "$http", function ($scope, $http) {
$scope.someFunction = function myfunction() {
}
}]);
When we usegetAngularControllerScope($('#Some-div'));
to get the scope the method someFunction()
is accessible and can be called like this getAngularControllerScope($('#Some-div')).someFunction()
But when the same div is loaded through an ajax call
getAngularControllerScope($('#Some-div'));
has no methods available.
Please help.
Loading of the html
$http.post('/SomeController/MyPartialAction', { data: "value" }).success(function (response) {
//load the partial view HTML in the div
$("#MyDiv").html(response);
});