Using Angular CLI
IntelliJ IDEA provides integration with Angular CLI.
On this page:
- Before you start
- Installing Angular CLI in IntelliJ IDEA
- Generating an Angular CLI application stub
- Using Angular CLI templates
Before you start
Make sure the NodeJS and AngularJS plugins are installed and enabled. The plugins are not bundled with IntelliJ IDEA, but they can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins. Once enabled, the plugins are available at the IDE level, that is, you can use it in all your IntelliJ IDEA projects.
Installing Angular CLI in IntelliJ IDEA
To use Angular CLI in IntelliJ IDEA projects, you need to install the angular-cli
package globally.
Do one of the following:
-
Run the installation from the command line in the global mode:
-
Launch the embedded Terminal
by hovering your mouse pointer over
in the lower left corner of IntelliJ IDEA and choosing Terminal from the menu (see Working with Embedded Local Terminal for details).
-
Switch to the directory where NPM is stored or define a
PATH
variable for it so it is available from any folder, see Installing NodeJs. -
Type the following command at the command line prompt:
npm install -g angular-cli
The
-g
key makes the framework run in the global mode. Because the installation is performed through NPM, the Angular CLI framework is installed in thenpm
folder. Make sure this parent folder is added to thePATH
variable. This enables you to launch the framework from any folder.For more details on the NPM operation modes, see npm documentation. For more information about installing the Angular CLI framework, see https://npmjs.org/package/angular-cli.
-
Launch the embedded Terminal
by hovering your mouse pointer over
-
Run NPM from IntelliJ IDEA using the Node.js and NPM page of the Settings dialog box.
- Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing for Windows and Linux or for OS X, and click Node.js and NPM under Languages&Frameworks.
-
On the Node.js and NPM page that opens, the Packages area shows all the Node.js-dependent packages
that are currently installed on your computer, both at the global and at the project level.
Click
.
- In the Available Packages dialog box that opens, select the required package to install.
-
Select the Options check box and type
-g
in the text box next to it. - Optionally specify the product version and click Install Package to start installation.
Generating an Angular CLI application stub
- Choose on the main menu or click the New Project button on the Welcome screen.
- 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.
- In the right-hand pane, choose AngularCLI and click Next.
-
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 NodeJS interpreter to use. Choose a configured interpreter from the drop-down list or choose Add to configure a new one, see Configuring Node.js Interpreters
-
When you click Finish ,
IntelliJ IDEA sets up the AngularJS-specific project structure and generates the
bower.json
andpackage.json
files with the definitions of all the necessary dependencies.
Using Angular CLI templates
The Angular CLI templates are listed on the Live Templates page of the Settings / Preferences Dialog, under the Angular2 node.
To use a template, type its abbreviation in the editor and then press Tab to expand it. Press Tab again to jump to the next edit location in the template.