Project Setup – Angular7 (Create first app)

Now the next step is to start your first angular project. Jump into the folder where you want to keep your projects, and follow the commands to install a new Angular 7 project :

C:\> ng new my-test-app

It’s going to present you with a couple questions before beginning:

Would you like to add Angular routing?

Which stylesheet format would you like to use? SCSS [ ]

It will take some minutes and once completed, you can now jump into the new project folder by typing:

c:\ cd my-test-app

Open up this project in your preferred code editor (I use Visual Studio Code, and you can launch it automatically by typing code . in the current folder), and then run this command to run a development server using the Angular CLI:

ng serve -o

-o is for open, this flag will open your default browser at http://localhost:4200. Tip: You can type ng to get a list of all available commands, and ng [command] –help to discover all their flags.

If it does not get opened by default. Go to your web page after the compiling process is completed. Type the URL Http://localhost:4200/my-test-app and your first page of the Angular gets opened.

Below will be seen on your web browser screen

Hurray! If everything goes well, you should be presented with the standard landing page template for your new Angular 7 project.

Now, we can use any IDE (editor) to edit and run our code. In this tutorial, we are using Visual Studio. Open the IDE and open your app “my-test-app” in it. It looks like below :

Now expand the “my-test-app” folder and

You will see 6 components in “app” folder there:

  • app.component.css
  • app.component.html
  • app.component.spec.ts
  • app.component.ts
  • app.module.ts
  • app-routing.module.ts

Now we will go through all the components to look and understand what is going on each one of them.


Here is no code in this file now. As, we have not added any code in this file yet.

This part is empty because we don’t specify any CSS here.


This is the most important component, the front page of your app. Here, you can change the salutation used before your app’s name. You can also change the content on the front page and their respective links.

This is the home page of your site, this is also called front page. Here, you can change the content, links of you page.


<!–The content below is only a placeholder and can be replaced.–>
<div style=”text-align:center”>
Welcome to landing page {{ title }}!
<imgwidth=”300″alt=”Angular Logo”src=”data:image/svg+xml;”>
<h2>Here are some links to help you start: </h2>
<h2><atarget=”_blank”rel=”noopener”href=””>Tour of Heroes</a></h2>
<h2><atarget=”_blank”rel=”noopener”href=””>CLI Documentation</a></h2>
<h2><atarget=”_blank”rel=”noopener”href=””>Angular blog</a></h2>


This file is used for testing purpose only.

import { TestBed, async } from ‘@angular/core/testing’;
import { RouterTestingModule } from ‘@angular/router/testing’;
import { AppComponent } from ‘./app.component’;
describe(‘AppComponent’, () => {
beforeEach(async(() => {
imports: [
declarations: [
it(‘should create the app’, () => {
it(`should have as title ‘my-test-app’`, () => {
it(‘should render title in a h1 tag’, () => {
expect(compiled.querySelector(‘h1’).textContent).toContain(‘Welcome to my-test-app!’);


You can change the name of your app here. You just have to change the title.

import { Component } from ‘@angular/core’;
styleUrls: [‘./app.component.css’]
export class AppComponent {


import { BrowserModule } from ‘@angular/platform-browser’;
import { NgModule } from ‘@angular/core’;
import { AppRoutingModule } from ‘./app-routing.module’;
import { AppComponent } from ‘./app.component’;
declarations: [
imports: [
providers: [],
bootstrap: [AppComponent]
export class AppModule { }




You may also like...