]-6ren"> ]-zone.js@0.6.25?main=browser:355 Unhandled Promise rejection: Template parse errors: 'ng-template' is-6ren">
gpt4 book ai didi

angular - 如果 'ng-template' 是 Web 组件,则将 "CUSTOM_ELEMENTS_SCHEMA"添加到该组件的 以抑制此消息。 ("[错误 ->]

转载 作者:太空狗 更新时间:2023-10-29 17:43:23 24 4
gpt4 key购买 nike

zone.js@0.6.25?main=browser:355 Unhandled Promise rejection: Template parse errors: 'ng-template' is not a known element: 1. If 'ng-template' is an Angular component, then verify that it is part of this module. 2. If 'ng-template' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->] ; Task: Promise.then ; Value: Error: Template parse errors: 'ng-template' is not a known element:

我已经在我的 App.module.ts 中应用了这个 FIX:

import { NgModule, CUSTOM_ELEMENTS_SCHEMA ,NO_ERRORS_SCHEMA}  from '@angular/core';


@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
JsonpModule,
CKEditorModule,
Ng2DatetimePickerModule,
Ng2DragDropModule,
DragulaModule,
ModalModule.forRoot(),
MaterialModule.forRoot(),
BootstrapModalModule,
RouterModule.forRoot(appRoutes, {useHash: true})
],
declarations: [something
],
providers: [],
bootstrap: [AppComponent],
schemas: [ CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA ]
})

包.JSON

"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"jquery": "~3.1.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},



"devDependencies": {
"@angular/compiler-cli": "2.2.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.21",
"codelyzer": "~1.0.0-beta.3",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}

即使在这之后它也无法正常工作。

最佳答案

<ng-template>在 Angular4 中引入。

用户要么 <template><ng-container>

另见

关于angular - 如果 'ng-template' 是 Web 组件,则将 "CUSTOM_ELEMENTS_SCHEMA"添加到该组件的 以抑制此消息。 ("[错误 ->]<ng-模板>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43318384/

24 4 0