I have a requirement to implement alert box in my project on click of a button depending on various conditions. Can you please suggest me how to implement alert box using Angular 2 and I don't require traditional window.alert()
Asked
Active
Viewed 5,432 times
1
-
Have a look at: https://github.com/valor-software/ng2-bootstrap – Michael Kang Mar 16 '17 at 06:54
-
can we make it without using bootstrap – thecrusader Mar 16 '17 at 07:21
-
Is there no way to get a $window.alert? – Steve Jun 27 '17 at 17:53
1 Answers
1
You can make use of angular2 package
npm install ng2-modal --save
`<button (click)="myModal.open()">Show popup</button>
<modal #myModal>
<modal-header>
<h1>Your header goes here</h1>
</modal-header>
<modal-content>
Body goes here
</modal-content>
<modal-footer>
<button class="btn btn-primary (click)="myModal.close()">Cancel</button>
</modal-footer>
</modal>`
For more details : https://www.npmjs.com/package/ng2-modal

Amit Chigadani
- 28,482
- 13
- 80
- 98