本机脚本角度元素解析错误:错误:无效属性 [(ngModel)]



Nativescript 角度应用错误:

元素解析错误: 错误:属性无效 [(ngModel(]。

使用模板"nativescript-template-ng-tutorial"创建的项目,但在使用角度标签(如[(ngModel)]*ngFor(时,我得到:

元素解析错误: 错误:属性无效 [(ngModel(]。

已经从nativescript-angular/forms导入了NativeScriptFormsModule。

这是我的应用程序.模块.ts文件

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
import { FormsModule } from '@angular/forms';
import { AppComponent } from "./app.component";
@NgModule({
declarations: [AppComponent],
bootstrap: [AppComponent],
imports: [NativeScriptModule, NativeScriptFormsModule, FormsModule],
schemas: [NO_ERRORS_SCHEMA],
})
export class AppModule {}

以下是错误的快照: 控制台中的错误

将 app.component.xml 的扩展名更改为 app.component.html并且没有发生任何错误。这是因为 XML 文件类型无法识别角度标记。 有关参考,请阅读以下链接中的提示:https://docs.nativescript.org/angular/tutorial/ng-chapter-3

相关内容

最新更新