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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -