[英]Migration to Angular Material from 14 to 15 fails
Following the migration guide i try to run按照迁移指南,我尝试运行
ng generate @angular/material:mdc-migration
This is the output i get:这是我得到的 output:
? Limit the migration to a specific directory? (Enter the relative path such as 'src/app/shared' or leave blank for all directories) src/app/shared
? What components do you want to migrate? Button, Card, Checkbox
Limiting migration to: src/app/shared
Migrating components:
button
card
checkbox
Migrating project: dummy-frontend
Cannot read properties of undefined (reading 'length')
UPDATE:更新:
i was able to run the script folder by folder我能够按文件夹运行脚本文件夹
we had the exact same error when migrating and we found that the components that were failing were the one with a template
instead of a templateUrl
, and with concatenation inside the template like this one:我们在迁移时遇到了完全相同的错误,我们发现失败的组件是使用template
而不是templateUrl
的组件,并且在模板内部进行了连接,如下所示:
@Component({
selector: 'app-dashboard-avancement-graph-dialog',
template: '<app-dialog-container>' +
'<app-dashboard-avancement-graph ' +
'[isFicheRex]="isFicheRex" ' +
'[perimeterSearch]="operationsParams" ' +
'[grapheOptions]="grapheOptions" ' +
'[autoload]="true">' +
'</app-dashboard-avancement-graph>' +
'</app-dialog-container>'
})
export class DashboardAvancementGraphDialogComponent {
@Input() public grapheOptions: GrapheOptionsParameters;
@Input() public operationsParams: PerimeterSearch;
@Input() public speSearch: SpecificSearch;
@Input() public isFicheRex = false;
}
If you replace the quotes and concatenation by back tick the migration succeed:如果您用反勾替换引号和连接,则迁移成功:
@Component({
selector: 'app-dashboard-avancement-graph-dialog',
template: `<app-dialog-container>
<app-dashboard-avancement-graph
[isFicheRex]="isFicheRex"
[perimeterSearch]="operationsParams"
[grapheOptions]="grapheOptions"
[autoload]="true">
</app-dashboard-avancement-graph>
</app-dialog-container>`
})
export class DashboardAvancementGraphDialogComponent {
@Input() public grapheOptions: GrapheOptionsParameters;
@Input() public operationsParams: PerimeterSearch;
@Input() public speSearch: SpecificSearch;
@Input() public isFicheRex = false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.