Born2Code
Born2Code

Reputation: 137

Show modal pop up in Angular 2

I am trying to integrate a modal up to my page based on implementation provided here in this post How to pass data to bootstrap modal dialog in Angular2 and working plunker solution was provided here http://plnkr.co/edit/8wBnEHOS5zNGXNhg9Tzy?p=preview

I have created a new plunkr in AngularJs (As Angular2) option was not there. But, when adding the AppComponent/ModalComponent to my app.ts file, i was seeing an error

   description"XHR error (404 Not Found) loading             http://run.plnkr.co/qf9bnaF8YtMFzfz9/app/app.component"

Here is my plunker code link - http://plnkr.co/edit/pRTaxiaU2S9dtiLYPEtl . Can someone help me whats going wrong here? Thank you !!!

Upvotes: 0

Views: 1023

Answers (2)

The Hungry Dictator
The Hungry Dictator

Reputation: 3484

Based on the reference of this question Please do as below.

import { CommonModule } from '@angular/common';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
import { CustomComponent } from './custom.component';

@NgModule({
  declarations: [ CustomComponent ],
  exports: [ CustomComponent ],
  imports: [ CommonModule ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class CustomModule {}

All you need to do is to add schema in @NgModule. Hope you get the solution.

Upvotes: 1

Vidur Singla
Vidur Singla

Reputation: 305

Add modal.component.ts in your app.module.ts

import { ModalComponent } from 'location of modal component'

declarations: [
       ModalComponent,
       .......
 ]

Upvotes: 0

Related Questions