angulardata-bindingangular-ngmodel

Why not use only two way data binding?


Why shouldn't I use two way data binding all the time?


Solution

  • When you're first starting angular, it's ok to use 2 way binding. But it got some disadvantages.

    First things comes to my mind are: It's template driven what that means is: you can't dynamically add or remove data to bind. You have'll to define all data fields at HTML and then hide or show them.

    Second is angular has change dedection cycle running behind the veils. It constantly checks if anything changed so it can update its counterpart. When you application is growing bigger and bigger, this performance load is adds up. And then you have to optimize.

    As I say, as a newcomer, you can use it. But you'll experience why you should use one way bindings and the other ways of angular yourself.