2

I am following steps in IntelliJ to support Angular.

https://www.jetbrains.com/help/idea/2017.1/using-angular.html#install_angular_cli

I have created the project successfully but do not know how to run it. I guess I have to mention some configuration in Edit Configuration option.

What is the way to run Angular2 application in IntelliJ?

Jota.Toledo
  • 27,293
  • 11
  • 59
  • 73
Manu Chadha
  • 15,555
  • 19
  • 91
  • 184
  • Probably I wrote too soon. I created an `npm` configuration with package name `C:\...AngularIntelliJ13\package.json` (picked from my project), command option was `run` and Scripts was `start`. Once I clicked play, I opened `http://localhost:4200/` (it was mentioned in logs) and could see the app. Is this the correct way to run Angular app? I noticed that the app didnt automatically refresh once I changed the code. I had to refresh the browser. – Manu Chadha Jun 16 '17 at 14:40
  • use the terminal provided to run your commands. For your app to refresh automatically you need the lite server and then serve the app. Once you make any changes and save them then it will automatically refresh in browser – Gautam Jun 16 '17 at 16:59
  • @Manu Chadha, yes, it's the right way – lena Jun 16 '17 at 19:01

4 Answers4

3

To run Angular application created with angular-cli in IDEA, you have to run npm start from NPM Tool Window to start the application, create JavaScript Debug run configuration for http://localhost:4200/ URL and hit Debug.

See https://blog.jetbrains.com/webstorm/2017/01/debugging-angular-apps/, https://www.youtube.com/watch?v=upgjCMHGpwo for more info. See also https://blog.jetbrains.com/webstorm/2016/04/angular-2-workflow-in-webstorm/

lena
  • 90,154
  • 11
  • 145
  • 150
1

Officially only the Ultimate version of IntelliJ has support for web applications enabled. The Community version does not support that (See here).

If you have the Ultimate version do as described on the IntelliJ website:

  1. Choose File | New | Project on the main menu or click the New Project button on the Welcome screen.

  2. In the Project Category and Options dialog, which is the first page of the New Project wizard, choose Static Web in the left-hand pane.

  3. In the right-hand pane, choose AngularCLI and click Next.

  4. On the second page of the wizard, specify the project name and the folder to create it in. In the Node Interpreter field, specify the Node.js interpreter to use. Choose a configured interpreter from the drop-down list or choose Add to configure a new one In the Angular CLI field, specify the path to the @angular/cli package. Optionally, in the Additional parameters field, specify the extra ng new options to pass to Angular CLI. Code completion is available in this field: as you start typing the name of an option or press Ctrl+Space, IntelliJ IDEA shows you the available options and their description.

When you click Finish, IntelliJ IDEA generates an Angular-specific project with all the required configuration files.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
0

To run Angular2 application in IntelliJ go through following steps:

  1. First you should be in angular-cli project
  2. run npm install (It will add all dependencies)
  3. Wait for Indexing to be done (otherwise your changes will not reflect)
  4. run npm serve (It will start server on http://localhost:4200)
Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
Gajanan Kulkarni
  • 697
  • 6
  • 22
0

There is no official support unless you have the ultimate edition. However, if you just want to start your angular project by clicking on run, you can do so by adding a shell configuration

Just go to "Run" -> "Edit Configurations" -> Click on Add Configuration("+") button on the left side -> Select "Shell Script" -> Select "Script text" -> Enter "ng serve" in the Script text field.

Then just select this configuration and click on play button, it should open up the embedded terminal and start the application.

Ayush Jain
  • 23
  • 4