Angular2 : two way binding inside parent/child component

后端 未结 5 1037
天涯浪人
天涯浪人 2020-12-09 08:24

Version: \"angular2\": \"2.0.0-beta.6\"

I would like to implement a two way binding inside a parent/child component case.

On my child component, I\'m using t

5条回答
  •  隐瞒了意图╮
    2020-12-09 09:29

    You can use @Input & @Output to achive 2 way binding between parent and child as mentioned in previous answers.

    Otherwise, there another solution, you can use a service that contains your variable, and you can access it with ngModel in the same time from different components (even if they are not parent-child)

提交回复
热议问题