javascript 挪用 angular.js 要领

var element = angular.element($document.getElementById("app"));
var controller = element.controller();
var scope = element.scope();
//挪用要领
scope.sub1();

//假如须要从新绑定
scope.$apply();

//挪用字段
scope.field1;

http://stackoverflow.com/ques…

angular.element(domElement).scope() to get the current scope for the element
angular.element(domElement).injector() to get the current app injector
angular.element(domElement).controller() to get a hold of the ng-controller instance.

    原文作者:Chobits
    原文地址: https://segmentfault.com/a/1190000000747708
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞