Hi, I got dynamic form working in an old project (probably some setting there) which can make it work, somehow when I tried to create a new project and tried to implement dynamic form only, I got this error message:
ERROR Error: Uncaught (in promise): Error: No template specified for component HomePage
Error: No template specified for component HomePage
at syntaxError (compiler.js:2430)
at DirectiveNormalizer.push…/node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer.normalizeTemplate (compiler.js:16194)
at CompileMetadataResolver.push…/node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.loadDirectiveMetadata (compiler.js:18392)
at compiler.js:26036
at Array.forEach ()
at compiler.js:26035
at Array.forEach ()
at JitCompiler.push…/node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._loadModules (compiler.js:26032)
at JitCompiler.push…/node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:26010)
at JitCompiler.push…/node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync (compiler.js:25970)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
at zone.js:892
at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
…
I even copied the exact same code to new project, still no luck, probably
I need to change some setting or import package? I actually just try the
example in this link:
https://angular.io/guide/dynamic-form
My home.page.ts:
import { Component } from ‘@angular/core’;
@Component({
selector: ‘app-home’,
//templateUrl: ‘home.page.html’,
styleUrls: [‘home.page.scss’],
})
export class HomePage {
constructor() {}
}
home.module.ts:
import { NgModule } from ‘@angular/core’;
import { CommonModule } from ‘@angular/common’;
import { IonicModule } from ‘@ionic/angular’;
import { FormsModule } from ‘@angular/forms’;
import { RouterModule } from ‘@angular/router’;
import { HomePage } from ‘./home.page’;
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild([
{
path: ‘’,
component: HomePage
}
])
],
declarations: [HomePage]
})
export class HomePageModule {}
app.component.ts:
import { Component } from ‘@angular/core’;
import { Platform } from ‘@ionic/angular’;
import { SplashScreen } from ‘@ionic-native/splash-screen/ngx’;
import { StatusBar } from ‘@ionic-native/status-bar/ngx’;
import { QuestionService } from ‘./question.service’;
@Component({
selector: ‘app-root’,
templateUrl: ‘app.component.html’
})
export class AppComponent {
questions: any;
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private questionService: QuestionService
) {
this.initializeApp();
this.questions = this.questionService.getQuestions();
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
}
}
Any suggestion is greatly appreciated!