iT邦幫忙

0

Angular standalone build 事件

  • 分享至 

  • xImage

當我使用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' }, ];

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答