これはmovie-info.html
から私のコードです:Ionic2未処理の約束拒否:テンプレートの解析エラー:「イオン・アイテム・コンテンツは」知ら要素ではありません。エラー
<ion-header>
<ion-navbar>
<ion-title>
Movie Info
</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="home" padding>
<div *ngIf="movie" class="selection">
<ion-card>
<ion-item>
<ion-avatar item-left>
<img src="path/to/image{{movie-poster}}"/>
</ion-avatar>
<ion-item-content class="movie-title-data">
<h1>{{movie.title}}</h1>
<p>{{movie.release_date}}</p>
</ion-item-content>
</ion-item>
<ion-item>
<icon document item-left></icon>
<h2>Overview</h2>
<p class="item-description">{{movie.overview}}</p>
</ion-item>
<ion-item>
<icon bookmark item-left></icon>
<h2>Average Vote</h2>
<p>{{movie.vote_average}}</p>
</ion-item>
</ion-card>
</div>
</ion-content>
これは、エラーは、私が取得:
Unhandled Promise rejection: Template parse errors:
'ion-item-content' is not a known element:
1. If 'ion-item-content' is an Angular component, then verify that it is part of this module.
2. If 'ion-item-content' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("path/to/image{{movie-poster}}"/>
</ion-avatar>
[ERROR ->]<ion-item-content class="movie-title-data">
<h1>{{movie.title}}</h1>
"): [email protected]:16
'icon' is not a known element:
1. If 'icon' is an Angular component, then verify that it is part of this module.
同様のエラーは、すべての要素で引き続き発生します。
これはmovie-info.ts
です:テンプレート・エラーのために
import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
@Component({
templateUrl: 'movie-info.html'
})
export class MovieInfoPage {
movie: {};
constructor(private navController: NavController, private navParams: NavParams) {
this.movie = navParams.get('movie');
}
}
だからあなたの 'MovieListPage'は、セレクタを持っていませんか? – echonax
@echonaxあなたはそれが何を意味するのか分かりません。これはIonic2を初めて使用するときです。 :) –
'@ Component'アノテーションの中で、' templateUrl'と 'providers'がある場合は、その要素を要素として参照する' selector'が必要です。しかし、イオンについてはあまりよく分かりませんが、それは違うかもしれません。 'MovieInfoPage'と' MovieListPage'の関係は何ですか? – echonax