Angular2 Popup Modal Window
Popup Modals are nowadays come in to play in a handy way which can be seen in most of the modern web applications. These Popup modals are usually come as a form, as confirmation message or can be used for many other activities in the web application. Though creating a Popup modal is not a very big deal this article will help you to get to know how to create a popup model in Angular.
Go to your Angular project folder and you should import Popup library to your project.
npm install ng2-opd-popup --save
Now run the project. Now copy the following import code from the npm guide and paste it in app.module.ts
;
Also you have to paste PopupModule
;
Also you have to paste PopupModule
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { NavbarComponent } from './Components/navbar/navbar.component';import {PopupModule} from 'ng2-opd-popup';
@NgModule({
declarations: [
AppComponent,
NavbarComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
PopupModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Above I have highlighted the codes that I have added to the file.
Now paste the following code in the top of the app.components.html file.
#popup1>Add your custom html elements here
Comments
Post a Comment