How to get current $sce outside controller?

后端 未结 3 1431
庸人自扰
庸人自扰 2021-01-16 05:49

For getting current $scope outside controller I can use,

 var $scope = angular.element(\'[ng-controller=ProductCtrl]\').scope();

How to get

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-16 06:16

    Better use a service to pass data between controllers or other services. Services act like a Singleton.

    Here is an example

提交回复
热议问题