Pass parameter to Angular 4 directive on input

前端 未结 3 906
我寻月下人不归
我寻月下人不归 2021-02-19 19:49

I have an input text field like this


and my dire

3条回答
  •  北海茫月
    2021-02-19 20:43

    Try like this in directive :

    import {Directive, Input, ElementRef} from 'angular2/core';
    @Directive({
        selector: '[inputTextFilter]'
    })
    class FocusDirective {
        @Input() inputTextFilter: any;
        protected ngOnChanges() {
             console.log('inputTextFilter', this.inputTextFilter);
        }
    }
    

提交回复
热议问题