angularjs - Why do I get undefined for this Angular scope? -
i use factory create objects particular module
angular.module("mymodule").factory('myentity', ....
and module accepts generated 'myentity' injected dependency:
angular.module("mymodule").controller('myproductctrl', [ '$scope', 'myentity', '$rootscope', 'myapiservice' ...
the module has following subscriber function used subscribe entity inside module this:
myentity.subscribe(function(otherentity) { $scope.myreference = otherentity; });
at runtime, above $scope.myreference assigned expected object it's value when first module loaded
... , i've added function onto scope inside same module:
$scope.mymodulefunction = function (product) { if (myreference.yadda) { ... } }
... above '$scope' undefined @ point function called via directive (in fact it's undefined once web page has been displayed). why might case?
Comments
Post a Comment