Newbie to AngularJS
! I am getting the controller scope in Javascript with the below code.
javascript
var controller = document.getElementById("listModules");
var controllerScope = angular.element(controller).scope();
controllerScope.$apply(function(){
controllerScope.newVariable = "test";
}
html
<div id="listModules" ng-controller="myCtrl"></div>
This is working fine and I am able to create new variable and access it but I want to return HTML from a function which needs $sce
inside the scope.
access $sce
controllerScope.$apply(function(){
controllerScope.newFunc = function(htmlString){
return $sce.trustAsHtml(htmlString)
}
}
I am stuck here to access $sce
. Any Ideas?