i am working on a ionic 3 app in which we have create the custom expandable component from the CLI but it got below error in the console :
Unexpected directive 'ExpandableComponent' imported by the module 'AppModule'. Please add a @NgModule annotation.
i have created ExpandableComponent and import in our app.module.ts fil.below our bapp.module.ts file
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { ServiceProvider } from '../providers/service';
import { HttpClientModule } from '@angular/common/http'
import { IonicStorageModule } from '@ionic/storage';
import { ExpandableComponent } from '../components/expandable/expandable';
@NgModule({
declarations: [
MyApp
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpClientModule,
ExpandableComponent,
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
ExpandableComponent
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
ServiceProvider
]
})
export class AppModule {}
<ion-list>
<button (click)="expandItem(item)" *ngFor="let item of itemList">
<ion-thumbnail item-start>
<img src="http://placehold.it/100">
</ion-thumbnail>
<h2>My Neighbor Totoro</h2>
<p>Hayao Miyazaki • 1988</p>
<expandable [expandHeight]="itemExpandHeight" [expanded]="item.expanded">
Hello people
</expandable>
</button>
</ion-list>
i have tried change the position of expandable component from module as well as entry component but not working.please tell me anyone what's the wrong in my code?