Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度2指令求值的控制顺序_Javascript_Angular_Angular2 Directives - Fatal编程技术网

Javascript 角度2指令求值的控制顺序

Javascript 角度2指令求值的控制顺序,javascript,angular,angular2-directives,Javascript,Angular,Angular2 Directives,我想在Angular 2中创建一个属性指令。它需要在其主机上有一个单击处理程序。在计算元素上的其他指令之前,需要添加click处理程序,因为它控制对某些功能的访问。在Angular 1中,您可以在创建指令时使用优先级选项来执行此操作。在Angular 2中是否有某种等价物 谢谢, Angular 2中不支持Chase优先级,也没有任何添加优先级的计划 组件指令不能使用以下属性: 优先级和终端。虽然Angular 1组件可以使用这些,但它们 在Angular 2中没有使用,最好不要编写这样的代码

我想在Angular 2中创建一个属性指令。它需要在其主机上有一个单击处理程序。在计算元素上的其他指令之前,需要添加click处理程序,因为它控制对某些功能的访问。在Angular 1中,您可以在创建指令时使用优先级选项来执行此操作。在Angular 2中是否有某种等价物

谢谢,
Angular 2中不支持Chase

优先级
,也没有任何添加优先级的计划

组件指令不能使用以下属性:

优先级终端。虽然Angular 1组件可以使用这些,但它们 在Angular 2中没有使用,最好不要编写这样的代码 依靠他们


参见

我发现指令在Angular 2中的求值顺序可以在ngModule decorator的声明块中定义。像这样:

@NgModule({
    imports: [BrowserModule], 
    // SecondDirective will be evaluated before FirstDirective
    declarations: [AppComponent, SecondDirective, FirstDirective],
    bootstrap: [AppComponent]
})

我从没见过这样的事。我想功能请求是正确的。在这种情况下,使用
组件
来承载其他指令不是更好吗?