2017-01-06 1 views
0

나는 이오닉 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 
    } 

} 
+0

감사합니다. 오류로 보입니다. 튜토리얼에서 다운로드 한 코드입니다. html에는 태그가 있습니다. 나는 그것을 수정하고 볼 것이다. – Richard

답변

2

h7 태그는 HTML 5에 존재하지 않습니다. 이것은 사용자 오류입니다. 이것은 ionic 또는 firebase 오류가 아닙니다. h6 또는 일부 다른 태그에 대해 h7을 변경하면이 오류는 사라집니다.

3

: 당신이 파서를 통해 그것을 확인하지 않는 템플릿 태그를 가지고, 해당 태그는

<h3> 

<h7> 

변경에게 그것을 인 예를 들어,

과 같이 작동해야합니다 (또는 div에 넣고 CSS 클래스로 원하는대로 스타일을 지정해야합니다).

관련 문제