Angular 4 Hello world

Angular 4 Hello World

Angular 4 Hello World

We are ready to create our first app in angular framework. We need to perform some steps in order to create a new app. Basically, Angular cli tool takes care of everything, we just need to invoke some commands.

Step 1 : Create Application Folder

First create a folder where you want to keep your project. For example (E:\angular\apps\).

Step 2 : Open command prompt

Open the command prompt and go the your project directory.


Some important CLI commands :

1. To create a new app

ng new app-name

2. To install a new module or dependency

npm install modulename --save

3. Create a new component

ng g c component-name

ng g c component-name --spec false (Skip test script files)

ng g c directory/component-name --spec false

4. Delete a component

ng destroy component component-name

5. Create a Service

ng g s service-name

6. Create a new class

ng g cl ClassName

Step 3 : Create new app

Create a new app by simple invoking ng command from angular cli tool. Open the command prompt and go to your directory then invoke the below command.

ng new hello-world

This will create a new angular app in your project with the name of hello-world. It may take some time because it downloads and configures all the required dependeices.

After the successful project creation, go the the product directory.

cd hello-world

Now you can start the application with the below command.

ng serve

And now you should be able to see the output as below

Angular 4 Hello World


Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *