angular - Unhandled Promise rejection: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input' -
this question has answer here:
i error can't bind 'ngmodel' since isn't known property of 'input'. if try use this:
<div *ngif="guide" class="form-group"> <label for="guidename">name: </label> <input class="form-control" name="guidename" [(ngmodel)]="test" required id="guidename"> <button (click)="saveguide(guide)"></button> </div>
my app.module.ts looks this:
import {ngmodule} "@angular/core"; import {routing} "./app.routing"; import {browsermodule} '@angular/platform-browser'; import {formsmodule} "@angular/forms"; import {guidemodule} "./guide/guide.module"; @ngmodule({ imports: [browsermodule, formsmodule, routing, guidemodule], declarations: [appcomponent], bootstrap: [appcomponent] }) export class appmodule {}
in package.json have:
"dependencies": { ... "@angular/forms": "^2.1.2", ... }
my systemjs.config.ts:
(function (global) { system.config({ paths: { // paths serve alias 'npm:': 'node_modules/' }, // map tells system loader things map: { // our app within app folder app: 'app', // angular bundles '@angular/core': 'npm:@angular/core/bundles/core.umd.js', '@angular/common': 'npm:@angular/common/bundles/common.umd.js', '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', '@angular/http': 'npm:@angular/http/bundles/http.umd.js', "@angular/forms": "node_modules/@angular/forms/bundles/forms.umd.js", '@angular/router': 'npm:@angular/router/bundles/router.umd.js', '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js', // other libraries 'rxjs': 'npm:rxjs', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js' }, // packages tells system loader how load when no filename and/or no extension packages: { app: { main: './main.js', defaultextension: 'js' }, rxjs: { defaultextension: 'js' } } }); })(this);
you getting error because guide-details.component.ts
not part of appmodule
imported formsmodule
(ngmodel
directive part of formsmodule
). have import formsmodule
in module in guide-details.component.ts
declared or move guide-details.component.ts
appmodule
's declarations.
Comments
Post a Comment