2
votes

I want to create custom modal window referring this link:- http://jasonwatmore.com/post/2017/01/24/angular-2-custom-modal-window-dialog-box

When i am using it's showing unknown HTML tag and on console showing error, i.e.

Unhandled Promise rejection: Template parse errors: 'modal' is not a known element: 1. If 'modal' is an Angular component, then verify that it is part of this module. 2. If 'modal' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" Open Modal 1

[ERROR ->]<modal id="custom-modal-1">
  <div class="modal">
    <div class="modal-body">

"): HeapMemoryGraphComponent@6:4 ; Zone: ; Task: Promise.then ; Value: Error: Template parse errors: 'modal' is not a known element:

Please guide,Thanks.

1
Is your modal code, i.e. the ts file with the selector: 'modal', registered in your app.module.ts file ? In your @NgModule declarations, after having imported the file ? - Fabien
Refer this answer - Aravind

1 Answers

0
votes

Put this component in declarations in the app.module

@NgModule({
imports: [
    BrowserModule,
    FormsModule
],
declarations: [
    AppComponent,
    ModalComponent <----
],
providers: [
    ModalService
],
bootstrap: [AppComponent]
})