Skip to content

The Difference between (ngModel) and [(ngModel)] with Example – AngularJS 2

Posted in Javascript

What is the difference between (ngModel) and [(ngModel)]?

I know you’re in a hurry for the answer, but a bit of understanding helps. The answer is:

(ngModel) causes a 1-way data-binding, whereas [(ngModel)] ensures a two-way data binding.

So, let’s do it with an example for understanding.

Below is a typical example taken from my Ionic 2 Series of articles:

Our associated controller might look like this:

See in action: