且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Angular世界之外发生更改时如何更新Angular 2 Reactive表单字段

更新时间:2023-02-12 11:10:52

内部指令:

您可以使用@Output发送事件并以

You can use @Output to send an event and capture it in the form

@Output typeaheadResult = new EventEmitter(); 

...

// Whenever user selects a result dispatch the event 
this.typeaheadResult.emit(changedInput);


您可以在HTML内捕获


Inside your HTML you can capture it

 <input formControlName="name"
          myTypeahead="'http://someRemoteUrl'"
          (typeaheadResult)="doSomething()"
           />