angular自定義組件

https://cli.angular.io/
css


 

打開終端建立header組件:html

ng g component components/header
import { Component, OnInit } from '@angular/core'; /*引入 angular 核心*/

@Component({
  selector: 'app-header', /*使用這個組件的名稱*/
  templateUrl: './header.component.html', /*html 模板*/
  styleUrls: ['./header.component.scss'] /*css 樣式*/
})
export class HeaderComponent implements OnInit { /*實現接口*/

  constructor() { }/*構造函數*/

  ngOnInit() {/*初始化加載的生命週期函數*/
  }

}
相關文章
相關標籤/搜索