Angular
JetBrains Rider integrates with Angular also known as Angular 2. This platform makes it easy to build web, mobile, or desktop applications.
Before you start
- Download, install, and configure Node.js as described in Configuring Node.js Interpreters.
- Install and enable the NodeJS and AngularJS plugins on the Plugins page as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Creating a new Angular application
You can use the angular-cli package or create an empty JetBrains Rider project and install Angular in it.
Generating an Angular application with Angular CLI
Angular CLI is the recommended way to start building a new Angular application. Angular CLI should be installed globally so it can be used in any JetBrains Rider project.
To install Angular CLI globally
Open the built-in JetBrains Rider Terminal (press Ctrl+Alt+1 or choose on the main menu) and type npm install -g @angular/cli
at the command prompt.
To create an application
- Choose Create New Project on the Welcome screen. The New Project Dialog opens. on the main menu or click
- In the left-hand pane, choose Angular CLI.
- In the right-hand pane:
- Specify the project name and the path to the folder where the project-related files will be stored.
- 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, see Configuring Node.js Interpreters
- In the Angular CLI field, specify the path to the
angular-cli
package.
- When you click Create, JetBrains Rider generates an Angular-specific project with all the required configuration files.
Installing Angular in an empty JetBrains Rider project
To create an empty JetBrains Rider project
- Choose Create New Project on the Welcome screen. The New Project Dialog opens. on the main menu or click
- In the left-hand pane, choose Empty Project.
- Specify the project name and the path to the folder where the project-related files will be stored.
- When you click Create, JetBrains Rider creates and opens an empty project.
To install Angular in an empty project
- Open the empty project where you will use Angular.
- Open the embedded Terminal ( ) and type
npm install @angular/core
at the command prompt. That will install the core Angular package with the critical runtime parts of the framework. You may also need to install other packages that are parts of Angular, see the list of packages.
Starting with an existing Angular application
If you are going to continue developing an existing Angular application, open it in JetBrains Rider and download the required dependencies.
If the application sources are already on your machine
Click Open on the Welcome screen or choose on the main menu. In the dialog that opens, select the folder where your sources are stored.
If the application sources are under version control
- Click Check out from Version Control on the Welcome screen or choose on the main menu.
- Select your version control system from the list.
- In the VCS-specific dialog that opens, type your credentials and the repository to check out the application sources from.
To download the dependencies
Open the embedded Terminal ( ) and type npm install
at the command prompt.
Generating Angular structures
In an Angular CLI project, you can have specific structures generated automatically.
- On the main menu, choose .
- In the pop-up list that opens, click the relevant type of structure.
- In the dialog box that opens, specify the name of the structure to be generated and the path to it relative to the
src/app
folder of your project. If you want to generate a structure in a separate folder, create this folder first. This does not apply to components, which are by default generated in separate folders unless the--flat
option is specified.If necessary, specify additional options, for example,
--flat
to have a new component generated directly in the specified location without creating a separate folder.
Using Angular language service
JetBrains Rider supports integration with the Angular language service developed by the Angular team to improve code analysis and completion for Angular-TypeScript projects. Note that the Angular language service works only with the projects that use Angular 2.3.1 or higher and TypeScript version compatible with it. Also make sure you have a tsconfig.json
file in your project.
To install the @angular/language-service package
- Open the Terminal tool window ( or Ctrl+Alt+1).
- Change the current folder to the project root and at the command prompt run
npm install @angular/language-service –save-dev
.
The Angular language service is activated by default so JetBrains Rider starts it automatically together with the TypeScript service and shows all the errors and warnings in your TypeScript and HTML files both in the editor and in the TypeScirpt Compiler window.
To activate or disable the service
- Open the Settings/Preferences by pressing Ctrl+Alt+S or by choosing for Windows and Linux or for macOS, and click Typescript under Languages & Frameworks.
- On the TypeScript page that opens, select the Enable TypeScript Compiler check box and click Configure next to it.
- In the Service options dialog box that opens, select or clear the Use Angular service check box.
Using Angular Material Design components
JetBrains Rider recognizes Angular Material components and attributes and provides coding assistance for them.
To install Angular Material
Open the built-in JetBrains Rider Terminal (press Ctrl+Alt+1 or choose on the main menu) and type npm install --save @angular/material
at the command prompt. For details, see Getting Started on the Angular Material Official website.
Support of Angular Material in JetBrains Rider includes
- Completion for components
- Completion for attributes
- Navigation between a component or an attribute and its declaration (F12 or on the context menu).