Phi*_*ipp 4 angular2-template angular
我刚刚更新到RC6并遇到以下错误:
zone.min.js:1未处理的Promise拒绝:模板解析错误:'sidebar'不是已知元素:1.如果'sidebar'是Angular组件,则验证它是否是此模块的一部分.2.如果"侧边栏"是Web组件,则将"CUSTOM_ELEMENTS_SCHEMA"添加到此组件的"@NgModule.schema"以禁止显示此消息.("
sidebar不是一个组成部分.只是我在我的一个模板中使用的html标签.它们看起来像这样:
...
<sidebar class="main-nav">
...
</sidebar>
...
Run Code Online (Sandbox Code Playgroud)
我尝试用CUSTOM_ELEMENTS_SCHEMA这样更新我的NgModule AppModule :
@NgModule({
declarations: [...],
providers: [...],
imports: [BrowserModule, routing, HttpModule, FormsModule, TranslateModule.forRoot()],
bootstrap: [AppComponent],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
但这似乎没有做任何事情.
有没有人有想法或暗示?
Phi*_*ipp 10
感谢Pankaj Parkar的评论.
sidebar似乎还没有被接受.我必须实施一个解决方法.
sidebar.directive.ts
import { Directive } from '@angular/core';
/**
* dummy directive to allow html-tag "sidebar"
*/
@Directive({ selector: 'sidebar'})
export class SidebarDirective {}
Run Code Online (Sandbox Code Playgroud)
包括在内 app.module.ts
@NgModule({
declarations: [..., SidebarDirective],
...
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10391 次 |
| 最近记录: |