1

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()

Amit Chigadani
  • 28,482
  • 13
  • 80
  • 98
thecrusader
  • 301
  • 6
  • 18

1 Answers1

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