模板解析错误不是已知元素(离子)

时间:2017-09-21 02:33:53

标签: list ionic-framework components expandable

感谢现在的帮助!     我遇到了这个问题,我正在做一个可开发的列表,请按照app.module.ts中的代码进行操作:

        import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { MyApp } from './app.component';
import { ExpansivoComponent } from '../components/expansivo/expansivo';


@NgModule({
  declarations: [
    MyApp,
    ExpansivoComponent
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp)

  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp

  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

这是我的html页面代码:

<ion-header>

  <ion-navbar>
    <ion-title>listacli</ion-title>
  </ion-navbar>

</ion-header>


<ion-content padding>
  <ion-list>
    <ion-item *ngFor="let item of items">
      <ion-thumbnail item-start>
        <img src="assets/img/listacli.png">
      </ion-thumbnail>
      <h2>My Neighbor Totoro</h2>
      <p>Hayao Miyazaki • 1988</p>
      <expansivo></expansivo>
      <button ion-button clear item-end>View</button>
    </ion-item>
  </ion-list>
</ion-content>

i already tryied a lot of answers from stackoverflow, but anything could help :(

这是error

如果你们需要任何代码,请问,谢谢!

1 个答案:

答案 0 :(得分:0)

您必须将ExpansivoComponent添加到entryComponents

$.getJSON('http://myurl', function(data) {
   for(var i = 0, len = data.length; i < len; i++) {
      var obj = data[i];
      //obj will be your item with obj.tier, obj.leagueName etc.
   }
});