Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show bootbox alert in Typescript/Angular2? [closed]

I want to use Bootbox in my Angular2 project. I searched a lot but there is no any relevant solution for me.
I also tried angular2-modal but there were many issues while using angular2-modal, please suggest any good doc/Examples/Demos for the same.

like image 541
Shubham Verma Avatar asked Feb 24 '17 08:02

Shubham Verma


1 Answers

Step 1: Install bootbox via npm install bootbox --save

Step 2: If you are using systemjs then include bootbox like:

<script src="node_modules/bootbox/bootbox.js"></script>

Step 3: Just put declare var bootbox:any; after import all libreries and before component decorator in your component ts file and then use normaly like bootbox.alert("Hello world!"); on any function call.

Make sure you have bootstrap and jquery installed and included in index page. jquery should be in first place then after bootstrap.

[Edit]

Alternate Step 3 Instead of declare var bootbox:any;, import type type definitions instead:

npm install @types/jquery --save
npm install @types/bootbox --save
like image 199
vikas Avatar answered Nov 06 '22 12:11

vikas