Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
201 views
Welcome To Ask or Share your Answers For Others

1 Answer

<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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...