ng-click得到当前元素,angular.element()用法
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
以下排版太乱,整理在此:点我
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="lib/jquery/jquery-1.10.2.min.js"></script>
<script src="lib/angular/angular.min.js"></script>
</head>
<body ng-app>
<div ng-controller="TestCtrl">
<a href data="1" ng-click="GoPage($event.target)">1</a>
<a href data="2" ng-click="GoPage($event.target)">2</a>
<a href data="3" ng-click="GoPage($event.target)">3</a>
<a href data="4" ng-click="GoPage($event.target)">4</a>
<a href data="5" ng-click="GoPage($event.target)">5</a>
{{ page }}
</div>
<script>
function TestCtrl($scope) {
$scope.page = 1;
$scope.getData = function () {
console.log($scope.page);
}
$scope.GoPage = function (target) {
$scope.page = target.getAttribute('data');
this.getData();
}
}
</script>
</body>
</html>
在Control中,angular.element()返回一个jquery对象,如angular.element(document).ready(function(){});
返回指定元素的scope
<code><span class="pln">angular</span><span class="pun">.</span><span class="pln">element</span><span class="pun">(</span><span class="pln">selector</span><span class="pun">).</span><span class="pln">scope</span><span class="pun">();</span></code>
Access and manipulate AngularJS $scope from browser's console
how to access the angular $scope variable in browsers console
AngularJs学习笔记--Scope
GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45
8 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 8 个月前
更多推荐
已为社区贡献7条内容
所有评论(0)