0
I 오류가 무엇입니까 찾을 수 없습니다 :템플릿 구문 분석이 : 파이프는
import { Component} from '@angular/core';
import { IonicPage, NavController, NavParams} from 'ionic-angular';
import { MomentModule } from 'angular2-moment';
...
@IonicPage()
@Component({
selector: 'page-item-detail',
templateUrl: 'service-booking-detail.html'
})
export class ServiceBookingDetailPage {
service: any;
...
constructor(..., navParams: NavParams, ...) {
this.service = navParams.get('service');
}
}
:
여기
Template parse errors: The pipe 'amDateFormat' could not be found
가 내 app.module.ts
import { NgModule } from '@angular/core';
...
import { MomentModule } from 'angular2-moment';
...
@NgModule({
declarations: [
MyApp
],
imports: [
...
MomentModule,
...
],
bootstrap: [IonicApp],
entryComponents: [
MyApp
],
providers: [
...
]
})
export class AppModule { }
다음 service-booking-details.ts
에서 나는 다음을 수행하고
다음 service-booking-detail.html
템플릿에서 나는 시도하고 있습니다 angular2 순간에서 파이프를 사용
<ion-content>
<ion-card>
<ion-card-content>
<p>{{ service.data | amDateFormat:'LL' }}</p>
</ion-card-content>
</ion-card>
</ion-content>
그런 다음 오류가 발생합니다 "템플릿 구문 분석 오류 : 파이프 'amDateFormat을'를 찾을 수 없습니다."
MomentModule을 가져 와서 오류없이 템플릿에서 사용할 수있는 방법은 무엇입니까?
문제를 재현하여 디버그하십시오. 표시된 템플리트 내용은 오류에서 언급 된 파이프가'amTimeAgo'가 아닌'amDateFormat'이므로 부적절한 것으로 보입니다. – amal
그것은 angular2-moment 모듈에서 다른 파이프를 디버깅하고 사용할 때의 복사/붙여 넣기 오류입니다. 위의 예는 | amDateFormat : 'LL'파이프도 있습니다. – cj1689262