What are the practical differences between template-driven and reactive forms?

后端 未结 6 1597
遇见更好的自我
遇见更好的自我 2020-11-28 19:08

I have been reading about Angular2 new Forms API and it seems that there are two approaches on forms, one is Template driven forms other is reactive or model-driven forms.

6条回答
  •  萌比男神i
    2020-11-28 19:14

    Reactive forms:

    • reusable,
    • more robust,
    • testable,
    • more scalable

    Template-driven forms:

    • easy to add,
    • less scalable,
    • basic form requirements

    In summaries, if forms are very important for your app, or reactive pattern are used in your app, you should use reactive forms.Otherwise your app have basic and simple requirement for forms such as sign in, you should use template-driven forms.

    There is a angular offical link

提交回复
热议问题