启动Angular应用程序时出现以下错误,即使未显示该组件也是如此.
我必须注释掉,以便我的应用程序正常运行.
zone.js:461 Unhandled Promise rejection: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("
<div>
<label>Created:</label>
<input type="text" [ERROR ->][(ngModel)]="test" placeholder="foo" />
</div>
</div>"): InterventionDetails@4:28 ; Zone: <root> ; Task: Promise.then ; Value:
Run Code Online (Sandbox Code Playgroud)
我正在看着英雄的掠夺者,但我没有看到任何区别.
这是组件文件:
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Intervention } from '../../model/intervention';
@Component({
selector: 'intervention-details',
templateUrl: 'app/intervention/details/intervention.details.html',
styleUrls: ['app/intervention/details/intervention.details.css']
})
export class InterventionDetails
{
@Input() intervention: Intervention;
public test : string = "toto"; …Run Code Online (Sandbox Code Playgroud) 我试图得到一个mat-slide-toggle但不幸的当前值我会得到一个错误:
Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'mat-slide-toggle'.
Run Code Online (Sandbox Code Playgroud)
我在我的组件的html部分中使用这样的切换:
<mat-slide-toggle color="primary" [(ngModel)]="showInnerView">
Default Slide Toggle
</mat-slide-toggle>
Run Code Online (Sandbox Code Playgroud)
我的组件中的相应属性:
showInnerView: boolean = false;
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
文件的mat-slide-toggle
官方例子的mat-slide-toggle一起[(ngModel)]
使用版本:Angular:5.2.4,Angular材料:5.2.0
我有一个复选框,我想要实现的是隐藏div复选框的时间,并在Angular 2.0 beta中取消选中时显示.
我知道如何使用此代码在角度1.2中执行此操作
<label>
<input type="checkbox" ng-model="showhidepregnant"/> Pregnant
</label>
Run Code Online (Sandbox Code Playgroud)
关于的代码 div
<div class="col-md-4 divhidetxtdpatient" ng-hide="showhidemasked">
<input class="form-control" tabindex="1" id="id_field_specialist" ng-model="id_field_specialist" type="text" ng-blur="savespecialist()" placeholder="maskable"/>
</div>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
ngModel抛出异常,这在rc4中工作正常
<input [(ngModel)]="par.name" placeholder="name" />
Run Code Online (Sandbox Code Playgroud)
这些是例外:
zone.js@0.6.12?main = browser:260 Uncaught EXCEPTION:./CommunityListComponent类中的错误CommunityListComponent - 内联模板:10:27 ORIGINAL EXCEPTION:没有带有未指定名称的表单控件的值访问器ORIGINAL STACKTRACE:错误:没有值访问器用于具有未指定名称的表单控件
我正在使用Angular 2.0 Alfa 35.当我导入时FORM_DIRECTIVES(这是formDirectivesAlfa 35 的新名称)我收到了一个Typescript错误:
error TS2305: Module '"angular2/angular2"' has no exported member 'FORM_DIRECTIVES'.
这是ts定义中的错误吗?我可以修复/覆盖它吗?
我正在做 Angular2 Heroes 教程:https ://angular.io/docs/ts/latest/tutorial/toh-pt1.html 在纯 Javascript(不是 Typescript)中,我在导入表单模块时遇到了问题:(描述仅适用于打字稿):
在我们对表单输入使用双向数据绑定之前,我们需要在我们的 Angular 模块中导入 FormsModule 包。我们将它添加到 NgModule 装饰器的导入数组中。此数组包含我们的应用程序使用的外部模块列表。
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule
],
declarations: [
AppComponent
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
当我将 Forms 模块添加到我的 app.module.js 导入数组时,它无法找到该模块:
zone.js:129 未捕获错误:模块“class2”导入的意外值“undefined”
这是我的 app.module.js:
(function(app) {
app.AppModule =
ng.core.NgModule({
imports: [ ng.platformBrowser.BrowserModule, ng.common.FORM_DIRECTIVES],
declarations: [ …Run Code Online (Sandbox Code Playgroud)