Angular 2 Beta
This answer is for those who use Javascript for angularJS v.2.0 Beta.
To use ngModel
in your view you should tell the angular's compiler that you are using a directive called ngModel
.
How?
To use ngModel
there are two libraries in angular2 Beta, and they are ng.common.FORM_DIRECTIVES
and ng.common.NgModel
.
Actually ng.common.FORM_DIRECTIVES
is nothing but group of directives which are useful when you are creating a form. It includes NgModel
directive also.
app.myApp = ng.core.Component({
selector: 'my-app',
templateUrl: 'App/Pages/myApp.html',
directives: [ng.common.NgModel] // specify all your directives here
}).Class({
constructor: function () {
this.myVar = {};
this.myVar.text = "Testing";
},
});