跳到主要內容

發表文章

目前顯示的是 11月, 2015的文章

JS apply Angulars controller

js  var s = angular.element($('#DivID')).scope();  s.genData(t,m); //Call Controller function  s.$apply(function () {}); //Initial Controller app.controller('Ctrl', function ($scope, $http,$sce) {     $scope.title=""     $scope.message=""     $scope.genData=function(t,m){             $scope.title=t;             $scope.message=m;     }      $scope.renderHtml = function(html_code)      {         return $sce.trustAsHtml(html_code);      }; }); html  [div id="DivID"  ng-controller="msgLightboxCtrl" ]          [div class="row"]             [div class="col-sm-12"]                  [h3 class="title"]{{title}}[/h3]                 [p class="message" ng-bind-html="renderHtml(message)"][/p]             [/div]          [/div]      [/div]