Angular 安裝

YH Lin
Oct 22, 2020

--

1.先安裝node.js

2.安裝 Angular CLI

Angular CLI 的主版本會跟隨它所支援的 Angular 主版本,不過其小版本可能會獨立發佈。

使用 npm 套件管理器來安裝 CLI:

npm install -g @angular/cli

透過 ng 可執行檔案可以在命令列建立或在開發伺服器上執行一個新的、基本的 Angular 專案,在命令列中執行下列命令:

ng new my-first-projectcd my-first-projectng serve

3.第一支APP

修改/src/app/app.component.ts

import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-app';
description = '媽~我在這裡';
}

修改 /src/app/app.component.html

<html>
<title>{{title}}</title>
<head></head>
<body>
{{description}}
</body>
</html>

執行np servet,出現網址列時,點選。

打完收工

--

--

No responses yet