當我使用standalone,打包時page2.component會產生兩次
很奇怪的是,當我把page2.component.ts的FormsModule移除
打包就不會產生兩次
想請問有沒有大大可以幫忙解惑一下~“~
**page2.component.html **<input class="m" type="text" name="StartDates" [(ngModel)]="val" #StartDates="ngModel" autocomplete="off" appFocusBlur />
page2.component.ts
`import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'app-page2',
standalone: true,
imports: [
CommonModule,
FormsModule,
],
templateUrl: './page2.component.html',
styleUrls: ['./page2.component.scss'],
})
export class Page2Component extends ContainerLayout {
val: any = 5;
}
`
路由設定const APP_ROUTES = [ { path: 'login', title: '登入喔', loadComponent: () => import('./@pages/login/login.component').then((m) => m.LoginComponent), }, { path: 'page2', title: '頁面2', loadComponent: () => import('./@pages/page2/page2.component').then((m) => m.Page2Component), }, { path: 'page2/:id', title: '明細', loadComponent: () => import('./@pages/page2/page2-detail/page2-detail.component').then((m) => m.Page2DetailComponent), }, { path: 'not-found', title: '找不到此頁面', loadComponent: () => import('./@pages/not-found/not-found.component').then((m) => m.NotFoundComponent), }, { path: '', redirectTo: 'login', pathMatch: 'full' }, { path: '**', redirectTo: '/login', pathMatch: 'full' }, ];