나는 이오닉 2를 사용하여 Firebase가 this tutorial을 기반으로 작동하지만 이오니아 rc4를 기반으로 작동하도록했습니다. 어떤 도움을 주셔서 감사합니다.처리되지 않은 약속 거부 : 템플릿 구문 분석 오류 :
Your system information: ordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI Version: 2.1.18 Ionic App Lib Version: 2.1.9 Ionic App Scripts Version: 0.0.47 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v6.9.2 Xcode version: Not installed
에는 컴파일 오류가 없습니다, 그러나 나는 다음과 같은 런타임 오류가 발생합니다 :
Unhandled Promise rejection: Template parse errors: 'h7' is not a known element: 1. If 'h7' is an Angular component, then verify that it is part of this module. 2. If 'h7' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" </h2> <p class="chat-text">{{item.chat_text}}</p> [ERROR ->]<h7 class="chat-time">{{item.timestamp | date:'dd/MM/yyyy'}}</h7> </ion-item> </ion-list> "): [email protected]:6 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors: 'h7' is not a known element: 1. If 'h7' is an Angular component, then verify that it is part of this module. 2. If 'h7' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" </h2> <p class="chat-text">{{item.chat_text}}</p> [ERROR ->]<h7 class="chat-time">{{item.timestamp | date:'dd/MM/yyyy'}}</h7> </ion-item> </ion-list> "): [email protected]:6 Stack trace: TemplateParser</[email protected]://localhost:8100/build/main.js:20796:19 RuntimeCompiler</[email protected]://localhost:8100/build/main.js:45698:30 RuntimeCompiler</RuntimeCompiler.prototype._compileComponents/<@http://localhost:8100/build/main.js:45618:56
그것은 HomePage
를 참조하는 것 같다,하지만 난 그게 오류가 있는지 모르겠습니다. home.ts 답변을 변환
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {LoginPage} from '../login/login';
import {
FirebaseAuth,
AngularFire,
FirebaseListObservable
} from 'angularfire2';
@Component({
templateUrl: 'home.html'
})
export class HomePage {
firelist: FirebaseListObservable<any>;
chat: any;
constructor(public nav: NavController, public af: AngularFire, public auth: FirebaseAuth) {
this.firelist = this.af.database.list('/chat', { //mengambil data
query: {
orderByChild: 'negativtimestamp', //order dari data yang terbaru
}
});
}
chatSend(va, vi) { //mengirim pesan chat
this.af.database.list('/chat').push({ // menambahkan data chat ke firebase
uid: window.localStorage.getItem('uid'),
img: window.localStorage.getItem('photoURL'),
username: window.localStorage.getItem('displayName'),
chat_text: va.chatText,
timestamp: Date.now(),
negativtimestamp: -Date.now() //buat nanti ambil data yang terbaru
})
this.chat = '';
}
logout() { // melakukan logout
window.localStorage.removeItem('email'); // remove email dari localStorage
window.localStorage.removeItem('uid'); // remove uid dari localStorage
window.localStorage.removeItem('displayName'); // remove displayName dari localStorage
this.auth.logout();
this.nav.setRoot(LoginPage);// kembali ke halaman LoginPage
}
}
감사합니다. 오류로 보입니다. 튜토리얼에서 다운로드 한 코드입니다. html에는 태그가 있습니다. 나는 그것을 수정하고 볼 것이다. –
Richard