是否可以从一个 angularjs 指令重定向到另一个?
Is it possible to redirect from one angularjs directive to another?
我想做这样的事情:
mymod.directive('SomeDirective',function(parms) {
// calculate target directive here, based on parms
// redirect to the target directive, and return result
return mymod.directive('SomeOtherDirective')(parms);
}
这可能吗?
答案是否定的。原因是指令工厂只在编译过程的早期被调用一次。
返回的对象用于每个指令实例,因此我必须使用它。
我想做这样的事情:
mymod.directive('SomeDirective',function(parms) {
// calculate target directive here, based on parms
// redirect to the target directive, and return result
return mymod.directive('SomeOtherDirective')(parms);
}
这可能吗?
答案是否定的。原因是指令工厂只在编译过程的早期被调用一次。
返回的对象用于每个指令实例,因此我必须使用它。