Angular 4 Popup Window Example

Angular 4 Popup Window

In this Angular modal tutorial we will be creating Angular 4 popup window modal by creating a button which will trigger the popup window function.

First open CMD and run:

npm install ng2-opd-popup

app.module.ts

import {PopupModule} from 'ng2-opd-popup'

 

 imports: [
PopupModule.forRoot(),
],

 

app.component.ts

import {Popup} from 'ng2-opd-popup';

 

export class AppComponent {

constructor (private popup:Popup) { }

ClickButton () {

this.popup.options= {
color: "red"

}

this.popup.show();
}

}

 

app.component.html

<popup>
Wrong password please try again </popup>

<button (click)="ClickButton()"> Login</button>

 

 


Subscribe to
for video tutorials updates