Reputation: 1358
How can I set run my angular 2 application from Intellij Idea run configuration menu?
From terminal I just put ng serve
but what should I select from list of configurations from Intellij Idea?
Upvotes: 24
Views: 14204
Reputation: 71911
One way to do it is to create a scripts entry in your package.json
, if it's not already there:
{
...
"scripts": {
"ng": "node_modules/.bin/ng",
"start": "ng serve -o -lr=false"
},
...
}
This will open the browser, and disable live-reloading (if that's what you would like.. If not, remove the -lr
option). This will also use a locally installed angular-cli
. This way you don't have to install it globally
Then create a new run configuration and choose npm
.
start
Make sure your node interpreter is set, and press ok
.
Now you can use the green button to run your configuration :)
You can also just right-click on your package.json
, and select show npm scripts
. This will open a window, where you can double click the 'start' script you just created
Upvotes: 41