1

For getting current $scope outside controller I can use,

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

How to get the current controllers $sce?

Imran Qadir Baksh - Baloch
  • 30,546
  • 66
  • 170
  • 302

3 Answers3

4

The $sce is a service so you can access it using the injector:

var elem = angular.element('[ng-controller=ProductCtrl]');
console.log("$scope: ",elem.scope());
console.log("$sce: ",elem.injector().get('$sce'));

example fiddle

caffeinated.tech
  • 6,248
  • 1
  • 20
  • 39
0

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

Here is an example

Community
  • 1
  • 1
0

For now my fix is,

window.trustAsHtml = $sce.trustAsHtml
Imran Qadir Baksh - Baloch
  • 30,546
  • 66
  • 170
  • 302