I have a function called load in a .js file. :
$scope.load = function(id){
alert(id);
};
This file is imported via a .jsp file and I'm attempting to call this function from this page :
angular.element(document).ready(function ($scope) {
$scope.load('76348')
});
The controller is defined within a div element :
<div ng-controller="mycontroller">
</div>
But I receive this error :
Uncaught TypeError: Object function ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
} has no method 'showLinks'
I think a new $scope is being created since the method is not being found ? Is there a mechanism for accessing the $scope from the .jsp page ? I just want to fire the angularjs method on page load so any other suggestions are appreciated.