AngularJS - 从控制器访问指令范围

时间:2014-02-03 16:01:58

标签: angularjs twitter-bootstrap pagination scope directive

我正在使用Angular UI分页angular-ui.github.io/bootstrap /

这是我需要访问的有用数字:totalItems

.directive('pagination', ['$parse', 'paginationConfig', function($parse, config) {
    return {
        restrict: 'EA',
        scope: {
            page: '=',
            totalItems: '=',
            onSelectPage:' &'
        },
        controller: 'PaginationController',
        templateUrl: 'template/pagination/pagination.html',
        replace: true,
        link: function(scope, element, attrs, paginationCtrl) {

如何从我的控制器访问它?我试过$scope.totalItems但没有任何反应。没有错误。

如果我在指令中观察totalItems,它会返回正确的值,但就像我说的那样,我需要从控制器访问它。可能也在HTML本身内。

由于

0 个答案:

没有答案
相关问题