AngularJS ng-model should have a dot
In our previous tutorial, we have …
See that ng-model=”itemToAdd” does not have a dot in it.
The AngularJS way is to have a dot somewhere in the value of the ng-model as in …
ng-model=”data.itemToAdd”
The use of “data” is arbitrary. You can use ng-model=”prop.itemToAdd” if you like.
While in our simple example, the app works either way. There are cases where it may not. For example, take a look at this tutorial as an aside.
It is a good habit to learn to put a dot in the ng-model because in more complex cases, things may not work without the dot. Egghead.io has a video explaining.