【发布时间】:2015-12-11 21:32:17
【问题描述】:
当ng-repeat 完成使用scope.$last 时触发此指令:
simpleSearchApp.directive('afterResults', function($document) {
return function(scope, element, attrs) {
if (scope.$last){
scope.windowHeight = $document[0].body.clientHeight;
}
};
});
我正在尝试使用新值更新$scope.windowHeight,但我无法在指令中访问$scope。
我的 ng-repeat 带有指令的 HTML:
<div ng-show="items" class="ng-cloak" ng-repeat="item in items" after-results>
{{item}}
</div>
【问题讨论】:
标签: javascript html angularjs