Getting Started
Before you start
Required Software
- NodeJS in a current version (we test with the current LTS version)
- IDE / Editor
- Visual Studio Code (free) or
- IntelliJ / WebStorm (or PhpStorm, commercial)
- Angular CLI (
npm i -g @angular/cli)- If installation fails b/c of local firewall settings, you can also work without the CLI by using npx.
If you use IntelliJ / WebStorm: Getting started with IntelliJ / WebStorm
If you use Visual Studio code, you can skip this section.
In this part of the tutorial, you will pull (or download & extract the .zip) the starter kit and run it.
Tip: Install and checkout the following useful tools for developing with Angular:
-
Pull the starter kit:
If you are using Linux or OS X, you should add the execution flag (x) to all files in the folder
node_modules\.binwithchmod:chmod -R +x node_modules. -
Open the starter kit in WebStorm/IntelliJ. This is the folder containing the
package.json. -
Switch to the terminal and start the starter kit with
npm start.
If you do not want to run the project in the IDE, you can also use
cmd(under Windows) orbash(under Linux and OS X) to open a shell in the root of the project and usenpm start. -
Open it in the browser (
http://localhost:4200). You should now see the demo application.If and only if this port is already taken, you can change adjust it in the project root's
package.jsonfile. To do this, add the--portoption to the node scripts / start:"scripts": { "start": "ng serve --port 4242", [...] }
If you use Visual Studio Code: Getting Started with Visual Studio Code
If you are using IntelliJ/WebStorm, you can skip this section.
In this part of the exercise, you will extract the starter kit (.zip) and run it.
Tip: Install the following useful plugins for developing with Angular:
In this part of the tutorial, you will pull (or download & extract ....zip) the starter kit and run it.
-
Pull the starter kit:
If you are using Linux or OS X, you should use
chmodto add the execution flag (x) to all files in thenode_modules/.binfolder:chmod -R +x node_modules. -
Open the starter kit in Visual Studio Code.
-
Change to the command line (
CTRL+SHIFT+C) or to the integrated Terminal (CTRL+SHIFT+รถ) -
Start the development server:
npm startNote: The development server does not put the required bundles on the disk but only keeps them in the main memory. When you change the source files, it recreates the bundles and then notifies the browser. To serve individual apps run
ng serve --project=<appname> -
Open the demo in Chrome (http://localhost:4200)
The port used may differ. You can see it from the console output at startup. If you want to change the port of a project, you can adjust this in the
package.jsonfile. To do this, add the--portoption to the nodescripts/start:"scripts": { "start": "ng serve [...] --port 4242", [...] }
Take a closer look at the starter kit
In this part, you will take a closer look at the starter kit to familiarize yourself with it.
Important hint: During all the labs, use
CTRL+pin Visual Studio Code to quickly jump to a specific file. You can do the same by pressingSHIFTtwice in WebStorm/PhpStorm/IntelliJ.
-
Look at the component in the
app.component.tsandapp.component.htmlin thesrc/appfolder and find out what they do. -
Look at the module in the
app.module.tsfile. -
Look at the
index.htmlfile. -
If you have not already done so, start the development web server:
npm start -
Open the project in the browser.