Angular 2 RC6 - "sidebar" is not a known element

I just upgraded to RC6 and ran into the following error:

zone.min.js: 1 Raw promise rejection: pattern parsing errors: the sidebar is not a known element: 1. If the sidebar is an Angular component, then make sure it is part of this module. 2. If the sidebar is a web component, add "CUSTOM_ELEMENTS_SCHEMA" to the "@ NgModule.schema" of this component to suppress this message. ("

sidebarnot a component. Just the html tag that I use in one of my templates. They look like this:

...
<sidebar class="main-nav">
    ...
</sidebar>
...

I tried updating my AppModule NgModule with the CUSTOM_ELEMENTS_SCHEMAfollowing:

@NgModule({
    declarations: [...],
    providers: [...],
    imports: [BrowserModule, routing, HttpModule, FormsModule, TranslateModule.forRoot()],
    bootstrap: [AppComponent],
    schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }

But it does nothing.

- ?

+4
2

.

sidebar, , . .

sidebar.directive.ts

import { Directive } from '@angular/core';

/**
 * dummy directive to allow html-tag "sidebar"
 */
@Directive({ selector: 'sidebar'})
export class SidebarDirective {}

app.module.ts

@NgModule({
    declarations: [..., SidebarDirective],
...
})
export class AppModule { }
+10

, workaround, , , , . , MoneyManagement, mm- . HTML tag/element sidebar, .

, bootstrap/ , sidebar.

.

<mm-sidebar class="main-nav">
    ...
</mm-sidebar>
+4

Source: https://habr.com/ru/post/1653417/


All Articles