我试图装饰Angular Material指令并且对Controller原型函数有疑问:
$provide.decorator('mdChipsDirective', ['$delegate', '$controller', function($delegate, $controller) {
var directive = $delegate[0];
var ctrlName = directive.controller;
directive.scope.minChips = "@mdMinChips";
directive.controller = function($scope, $attrs, $mdConstant, $log, $element, $timeout, $mdUtil) {
var controller = $controller(ctrlName, {
$scope: $scope,
$attrs: $attrs,
$mdConstant: $mdConstant,
$log: $log,
$element: $element,
$timeout: $timeout,
$mdUtil: $mdUtil
}, true);
console.log("controller", controller);
return controller;
}
console.log('directive', directive)
return $delegate;
}]);