2017-01-06 9 views
0

私は、イオニック2を使用して、Fireベースがthis tutorialに基づいて動作するようにしようとしていますが、Ionic 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タグはHTML5に存在しません。これはエラーです。これはionicまたはfirebaseエラーではありません。 h6または他のタグのh7を変更するだけで、このエラーは消滅します

3

:あなたはパーサを通してそれを作るていない、あなたのテンプレートでタグを持って、そのタグは

<h3> 

<h7> 

変更にそれをされて

などです。これは動作する必要があります(またはdivに入れて、CSSクラスで必要に応じてスタイルを設定します)。

関連する問題