Angular 4 Hello WorldWe 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 FolderFirst create a folder where you want to keep your project. For example (E:\angular\apps\).
Step 2 : Open command promptOpen 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 appCreate 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.
Now you can start the application with the below command.
And now you should be able to see the output as below