Pass parameter to Angular 4 directive on input

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

I have an input text field like this


and my dire

3条回答
  •  既然无缘
    2021-02-19 20:23

    Try this.

    Update:

    import {Directive, SimpleChanges} from '@angular/core';
    
    @Directive({
      selector: '[inputTextFilter]'
    })
    export class MyDirective {
      @Input('inputTextFilter') params: string;
      constructor(){}
      ngOnInit(){
         console.log(this.params)
      }
    }
    

提交回复
热议问题