0
ERROR in C:/projects/chat/src/app/services/chat.service.ts (32,10): Expression expected.
ERROR in C:/projects/chat/src/app/services/chat.service.ts (32,10): Expression expected.
ERROR in ./src/app/services/chat.service.ts
Module parse failed: C:\projects\chat\node_modules\@ngtools\webpack\src\index.js!C:\projects\chat\src\app\services\chat.service.ts Unexpected token (24:15)
You may need an appropriate loader to handle this file type.
| }
| ChatService.prototype.getMessages = function() {
| return .this.db.list('messages', {
| query: {
| limitToLast: 25,
@ ./src/app/app.module.ts 25:0-54
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
ChatServiceこのファイルタイプを処理するには、適切なローダーが必要な場合があります。 Angular4-Firebase式予想エラー
import { Injectable } from '@angular/core';
import {AngularFireDatabase,FirebaseListObservable} from 'angularfire2/database';
import {AngularFireAuth} from 'angularfire2/auth';
import {Observable} from 'rxjs/Observable';
import {ChatMessage} from '../models/chat-message.model';
import {AuthService} from '../services/auth.service';
import * as firebase from'firebase/app';
@Injectable()
export class ChatService {
user: any;
chatMessages: FirebaseListObservable<ChatMessage[]>;
chatMessage: ChatMessage;
userName: Observable<string>;
constructor(private db: AngularFireDatabase,private afAuth: AngularFireAuth) {
//this.afAuth.authState.subscribe(auth=>{
//if(auth !== undefined && auth !==null){
//this.user = auth;
//}
//});
}
getMessages(): FirebaseListObservable<ChatMessage[]>{
return.this.db.list('messages',{
query: {
limitToLast:25,
orderByKey: true
}
});
}
getTimeStamp(){
const now = new Date();
const date = now.getUTCFullYear() + '/' +
(now.getUTCMonth() +1) + '/' +
now.getUTCDate();
const time = now.getUTCHours() + ':' +
now.getUTCMinutes() + ':' +
now.getUTCSeconds();
return (date+' '+time);
}
sendMessage(msg: string){
const timestamp = this.getTimeStamp();
//const email = this.user.email;
const email = "[email protected]";
this.chatMessages = this.getMessages();
this.chatMessages.push({
message: msg,
timeSent: timestamp,
//userName: this.userName,
userName: "testuser",
email: email
});
}
}
私は、バックエンドとしてフロントエンドとFirebaseとして、角度4とchatappの構築に関するYouTubeでチュートリアルを次れた私はすべてを追ったが、まだこれを持ちますエラー。何か案は?私はすべての依存関係をインストールしていると確信しています。