首页 > 技术文章 > JS调用AngularJS中的方法

wt616 2015-09-02 15:48 原文

案例:

在IONIC中使用百度地图的JS版SDK,在该JS相关界面中需要触发点击事件来实现在Ionic的JS中定义的函数,参考方法如下:

onclick="var $scope = angular.element(event.target).scope();$scope.hello()"

 

其中var $scope = angular.element(event.target).scope()代码就是当前js被触发时候的那个scope

推荐阅读