Three way binding in Angular 2 and Angularfire2

后端 未结 1 744
终归单人心
终归单人心 2021-02-02 17:03

I am trying to three-way bind an input element to firebase database in Angular.js 2 (2.0.0-rc.4), using AngularFire 2 (2.0.0-beta.2).

I have a very simple html like:

相关标签:
1条回答
  • 2021-02-02 17:34

    Seven months later and I have an answer for you.. extended ngModel syntax..

    <input [ngModel]='(model|async)?.author' (ngModelChange)="model.update({author: $event})">
    

    The [] block is a getter and the () block is a setter. Since the model's getter is actually unwrapping the FirebaseObjectObservable, you have to use the FirebaseObjectObservable's binding to set it.

    0 讨论(0)
提交回复
热议问题