html:
<div ng-controller="FilterController as ctrl">
js:
angular.module('FilterInControllerModule', []).
controller('FilterController', ['filterFilter', function(filterFilter) {
this.array = [
{name: 'asnowwolf'},
{name: 'why520crazy'},
{name: 'joe'},
{name: 'ckken'},
{name: 'lightma'},
{name: 'FrankyYang'}
];
this.filteredArray = filterFilter(this.array, 'a');
}]);
这样可以通过ctrl.array来访问FilterController控制器里的array数组,可是我通过FilterController.array却访问不了,这是为什么?还有FilterController控制器里的this是不是指FilterController?
习惯受伤
相关分类