您的位置:首页 > Web前端 > AngularJS

angularjs指令中的scope引用父作用域的函数,如何传递参数

2014-05-24 00:00 148 查看
html

<div ng-controller="paginationDemoCtrl" class="text-center">

<pagination class="pagination-sm" total-items="totalItems" page="currentPage" on-select-page="pageChanged(chenyiqi)" previous-text="‹" next-text="›" num-pages="numPages" ></pagination><pre>共{{ numPages }}页,{{ totalItems }}条</pre>

</div>

指令

scope: {

page: '=',

totalItems: '=',

onSelectPage:' &'

},

指令中的onSelectPage指定引用标签中指明的父作用域中的函数,传递参数为chenyiqi;

$scope.onSelectPage({ chenyiqi: page });

在此处将给参数chenyiqi赋值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: