发布于 2015-03-08 23:01:11
好的!您可以修饰指令并扩展它或完全覆盖它。这是一个很好的blog post on this
最直截了当的方法是:
app.config(function($provide) {
$provide.decorator('collapseDirective', function($delegate) {
var directive = $delegate[0];
var link = function myLinkFnOverride(scope, element, attrs) {
// code here...
}
directive.compile = function() {
return function(scope, element, attrs) {
link.apply(this, arguments);
};
};
return $delegate;
});
});它将完全覆盖原始链接函数(需要复制、粘贴所有链接并更改所需的部分)
https://stackoverflow.com/questions/28932414
复制相似问题