1. Cannot bind a value to NgModel in component
Issue: cannot set value to [(ngModel)]=”startDate” in any Component
Reason: lack of import IonicModule, FormsModule in ComponentModule
Solution:
// in your-component.modules.ts file
imports: [
......
IonicModule,
FormsModule
]
2. ERROR Error: Uncaught (in promise): Error: JIT compiler unavailable Error: JIT compiler unavailable
Điều này xảy ra khi trong component của bạn có sử dụng @ViewChild.
export class UserprofilePage implements OnInit { @ViewChild(MemberdetailsComponent) memberDetails: MemberdetailsComponent; // Sử dụng view child ở đây @ViewChild(MemberNomineeDetailComponent) nominees: MemberNomineeDetailComponent;
Nguyên nhân:
https://github.com/angular/angular/issues/37244
Cách fix: go to tsconfig.json
"angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, "strictTemplates": true, "compileNonExportedClasses": false // <-- Thêm dòng này vào }