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
  • 32,612
  • 68
  • 179
  • 322

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,428
  • 1
  • 21
  • 40
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
  • 32,612
  • 68
  • 179
  • 322