这是我movie-info.html
的代码:
<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>
"): MovieInfoPage@15: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');
}
}