Binding 'this' in Angular Material Autocomplete displayWith using Angular 5

前端 未结 5 751
借酒劲吻你
借酒劲吻你 2021-01-04 10:50

I was trying to use the Material Angular autocomplete and I came across the displayWith function which can be apparently used to be the output that is displayed on selection

5条回答
  •  再見小時候
    2021-01-04 11:28

    displayFn = value => {
      // now you have access to 'this' 
      this.someMethod();
      return 'formatted display';
    }
    

提交回复
热议问题