0
我需要測試一些指令並獲取其中一個局部變量來檢查其值。該指令本身看起來這樣:訪問本地變量,同時在AngularJS中進行指令單元測試
angular.module('app').directive('favoritesList', function() {
return {
restrict: 'E',
replace: true,
templateUrl: 'templates/directives/favoritesListDirective.html',
controller: function ($scope, $rootScope, $rootElement, $filter, ContactService, ContactFollowerService, Restangular) {
var listLimit = 100, // in order to prevent favoritesList *overflow*
followedFilter = {filters: {followed: true}, page_size:listLimit};
// get Favorites List
ContactService.provider.getList(followedFilter) //
.then(function(result){
$scope.favorites=result;
}, function(message){
console.warn('Cannot get a Favorites List',message);
});
....
}
};
});
所以,我怎樣才能訪問followedFilter變量在描述/它塊?
不能的方式,這是寫的。請參閱下面的答案 – Katana24