1.2 Angular - Create A New Project
1.2 Angular - Create A New Project
1.2 Angular - Create A New Project
mode_edit
Create a new project
Use the ng new command to start creating your Tour of Heroes
application.
This tutorial:
ng new angular-tour-of-heroes
ng new also creates the following workspace and starter project files:
cd angular-tour-of-heroes
ng serve --open
https://angular.io/tutorial/tour-of-heroes/toh-pt0 2/7
05/07/2023, 15:57 Angular - Create a new project
Angular components
The page you see is the application shell. The shell is controlled by an
https://angular.io/tutorial/tour-of-heroes/toh-pt0 3/7
05/07/2023, 15:57 Angular - Create a new project
FILES DETAILS
Skip to main content
app.component.html (template)
<h1>{{title}}</h1>
https://angular.io/tutorial/tour-of-heroes/toh-pt0 4/7
05/07/2023, 15:57 Angular - Create a new project
The double curly braces are Angular's interpolation binding syntax. This
Skip to main content
interpolation binding presents the component's title property value
inside the HTML header tag.
https://angular.io/tutorial/tour-of-heroes/toh-pt0 5/7
05/07/2023, 15:57 Angular - Create a new project
src/styles.css (excerpt)
Skip to main content
/* Application-wide Styles */
h1 {
color: #369;
font-family: Arial, Helvetica, sans-serif;
font-size: 250%;
}
h2, h3 {
color: #444;
font-family: Arial, Helvetica, sans-serif;
font-weight: lighter;
}
body {
margin: 2em;
}
body, input[type="text"], button {
color: #333;
font-family: Cambria, Georgia, serif;
}
button {
background-color: #eee;
border: none;
border-radius: 4px;
cursor: pointer;
color: black;
font-size: 1.2rem;
padding: 1rem;
margin-right: 1rem;
margin-bottom: 1rem;
margin-top: 1rem;
}
button:hover {
background-color: black;
color: white;
}
button:disabled {
background-color: #eee;
color: #aaa;
cursor: auto;
}
/* everywhere else */
https://angular.io/tutorial/tour-of-heroes/toh-pt0 6/7
05/07/2023, 15:57 Angular - Create a new project
* {
font-family: Arial, Helvetica, sans-serif;
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Tour of Heroes';
}
Summary
You created the initial application structure using ng new .
https://angular.io/tutorial/tour-of-heroes/toh-pt0 7/7