javascript - AngularJS, input textbox not even showing -
i'm running basic default boiler plate code , edited file:
app.component.html
<input type="text" [(ngmodel)]="name"> <p> {{name}} </p>
app.component.ts
import { component } '@angular/core'; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.css'] }) export class appcomponent { name = ''; }
but literally nothing. there blank page. doing wrong? seems basic
since ngmodel
directive included in formsmodule
, have import , add module inside imports
metadata option of appmodule
.
code
import { ngmodule } '@angular/core'; import { formsmodule } '@angular/forms'; //<-- formsmodule import import { browsermodule } '@angular/platform-browser'; import { appcomponent } './app.component'; @ngmodule({ imports: [ browsermodule, formsmodule ], //<-- added formsmodule imports option declarations: [ appcomponent ], bootstrap: [ appcomponent ] }) export class appmodule { }
Comments
Post a Comment