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

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -