# 起步
# Angular CLI
npm install -g @angular/cli
ng new <project-name>
cd <project-name>
ng serve --open
ng serve
ng build
ng generate
ng test # 单元测试
ng e2e # 端到端测试
# Hello world
ng new angular-startup
cd angular-startup
npm start
ng generate component hello-world
// src\app\hello-world\hello-world.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-hello-world',
templateUrl: './hello-world.component.html',
styleUrls: ['./hello-world.component.scss']
})
export class HelloWorldComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<!-- src\app\hello-world\hello-world.component.html -->
<p>hello-world works!</p>