angularjs指令中的scope引用父做用域的函數,如何傳遞參數

htmlhtml

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

<pagination class="pagination-sm" total-items="totalItems" page="currentPage" on-select-page="pageChanged(chenyiqi)" previous-text="&lsaquo;" next-text="&rsaquo;" num-pages="numPages" ></pagination><pre>共{{ numPages }}頁,{{ totalItems }}條</pre>
spa

</div>htm

指令作用域

    scope: {it

      page: '=',io

      totalItems: '=',class

      onSelectPage:' &'select

    },rsa

指令中的onSelectPage指定引用標籤中指明的父做用域中的函數,傳遞參數爲chenyiqi;

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

在此處將給參數chenyiqi賦值

相關文章
相關標籤/搜索