1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterLink } from '@angular/router';
interface navListType{ title: string, path: string, } @Component({ selector: 'app-navbar', //這是元件的名稱 standalone: true, imports: [ RouterLink,CommonModule, ], templateUrl: './navbar.component.html', styleUrl: './navbar.component.scss' }) export class NavbarComponent {
navLists: navListType[] = [ { title: 'Home' ,path:'index'}, {title:'FetchData',path:'fetch-data'} ] //頁面名稱 pageTitle: string = 'Home';
// isActive: boolean = false;
//點擊頁面按鈕函式 actionList(path: string) { this.pageTitle = path; } }
|