[英]How to pass input variable in structure directive?
There is a structure directive:有一个结构指令:
@Directive({
selector: '[loading]',
})
export class LoadingDirective {
loadingFactory: ComponentFactory<LoadingComponent>;
loadingComponent: ComponentRef<LoadingComponent>;
@Input()
set loading(loading: boolean) {}
@Input('loadingSize') size: number;
}
I have tried to pass size:我试图传递大小:
<span *loading="true size=20"></span>
<span [loading]="true" [loadingSize]="20"></span>
Each input property stands on its own, and the *
is not necessary每个输入属性都是独立的, *
不是必需的
EDIT编辑
change改变
@Input()
set loading(loading: boolean) {}
to至
@Input() loading: boolean;
otherwise you are not doing anything with the value, since your setter function is empty否则你没有对这个值做任何事情,因为你的设置器 function 是空的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.