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
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞