Create a new component withionic g c list-user
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-list-user',
templateUrl: './list-user.component.html',
styleUrls: ['./list-user.component.scss'],
})
export class ListUserComponent implements OnInit {
constructor() { }
And this is the file app.module.ts
import { ListUser } from './list-user/list-user.component';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent, ListUser],
ngOnInit() {}
}
This is the error I get:
compiler.js:2430 Uncaught Error: Unexpected value 'undefined' declared by the module 'AppModule'
at syntaxError (compiler.js:2430)
at compiler.js:18685
at Array.forEach (<anonymous>)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata (compiler.js:18683)
at
Your app.module.ts file looks a bit funny if you notice some code is missing. This file usually has two differentiated parts.
In your code I don't see the export of the AppModule class, see if adding it solves it. I seem to remember that in ionic every time you generate a new component it generates a module for each of these components, so it may not be necessary to add it to the global AppModule. Try these two things to see, if they don't work, show the error that shows you again.