I am a newbie on AngularJS. I have the following angularJS code
(function () {
getDataFactory = function ()
{
return {
callWebApi: function (reqData)
{
alert(reqData);
}
}
}
patientCategoryController = function ($http, $scope, getDataFactory) {
// The following line is the culprit. If this is commented, I dont get the error.
// But it works, ie. when UNcommented, I get the messagebox showing
// "someDataToPass"!! So whats wrong???
angular.element(document).ready(getDataFactory.callWebApi('someDataToPass'));
}
patientCategoryController.$inject = ['$http', '$scope', 'getDataFactory'];
angular.module('demoApp', []);
angular.module('demoApp').controller('patientCategoryController', patientCategoryController);
angular.module('demoApp').factory('getDataFactory', getDataFactory);
}());
I found the method call
angular.element(document).ready(getDataFactory.callWebApi('someDataToPass'));
is the problem. So I am missing some thing very basic. Can someone please guide me on this. The HTML is absolute basic skeleton. I get this error in Chrome browser, right click and then select inspect page element.