WilloPillow WilloPillow - 9 months ago 95
Javascript Question

Angular 2 ngModel not working ( javascript only )

So I'm a newbie on Angular2(javascript) and I was able to make a simple "Hello world" with the angular 5 min tutorial. And I was curious of the new changes on Angular2 I start reading the Angular2 Js docs but I found that it was incomplete(sucks), so I started playing around, and I got stuck on two way binding. It always returns undefined

My current script:

( function(app) {
app.TestComponent =
selector: 'test-comp',
template: '<input ([ngModel])="name"><input type="button" (click)="click()" value="click">'
constructor: function(){},
click: function(){ console.log(this.name) }

(function(app) {
app.AppModule =
imports: [
declarations: [ app.TestComponent ],
bootstrap: [ app.TestComponent ]
constructor: function() {}
})(window.app || ( window.app = {} ));

Whats puzzling me is there are no errors. Which makes it more difficult to Identify whats causing the undefined. Help!

Answer Source

It has to be




It's called banana in a box for a reason ;-)