|
@@ -20,44 +20,50 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
20
|
20
|
|
21
|
21
|
|
22
|
22
|
|
23
|
|
-/**
|
24
|
|
- * Generated class for the ChatPage page.
|
25
|
|
- *
|
26
|
|
- * See https://ionicframework.com/docs/components/#navigation for more info on
|
27
|
|
- * Ionic pages and navigation.
|
28
|
|
- */
|
|
23
|
+// import {OnInit} from '@angular/core';
|
|
24
|
+// import { interval } from '../../../node_modules/rxjs/observable/interval';
|
|
25
|
+// import { startWith } from '../../../node_modules/rxjs/operators';
|
|
26
|
+// import { switchMap } from '../../../node_modules/rxjs/operator/switchMap';
|
29
|
27
|
var ChatPage = /** @class */ (function () {
|
30
|
28
|
function ChatPage(navCtrl, navParams, messageApi) {
|
31
|
29
|
this.navCtrl = navCtrl;
|
32
|
30
|
this.navParams = navParams;
|
33
|
31
|
this.messageApi = messageApi;
|
|
32
|
+ this.mApi = messageApi;
|
34
|
33
|
}
|
35
|
34
|
ChatPage.prototype.ionViewDidLoad = function () {
|
36
|
35
|
console.log('ionViewDidLoad ChatPage');
|
37
|
|
- this.getMessages();
|
|
36
|
+ this.getMessages(this);
|
38
|
37
|
};
|
39
|
38
|
ChatPage.prototype.send = function (createAccountInfo) {
|
40
|
39
|
console.log("clicked");
|
41
|
40
|
console.log(createAccountInfo);
|
42
|
41
|
this.messageApi.saveMessage(createAccountInfo).subscribe(console.log);
|
43
|
|
- this.getMessages();
|
|
42
|
+ this.test = '';
|
|
43
|
+ this.getMessages(this);
|
44
|
44
|
};
|
45
|
|
- ChatPage.prototype.getMessages = function () {
|
|
45
|
+ ChatPage.prototype.getMessages = function (chatPage) {
|
46
|
46
|
var _this = this;
|
47
|
|
- this.messageApi.getMessages().subscribe(function (data) {
|
|
47
|
+ chatPage.messageApi.getMessages().subscribe(function (data) {
|
48
|
48
|
_this.msg = data;
|
49
|
|
- console.log(data);
|
|
49
|
+ console.log(_this.msg);
|
50
|
50
|
});
|
51
|
|
- this.test = this.messageApi.getCurrentMessage();
|
52
|
51
|
};
|
|
52
|
+ ChatPage.prototype.ngOnInit = function () {
|
|
53
|
+ var _this = this;
|
|
54
|
+ setInterval(function () { _this.getMessages(_this); }, 500);
|
|
55
|
+ };
|
|
56
|
+ __decorate([
|
|
57
|
+ Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */])(),
|
|
58
|
+ __metadata("design:type", Array)
|
|
59
|
+ ], ChatPage.prototype, "messages", void 0);
|
53
|
60
|
ChatPage = __decorate([
|
54
|
61
|
Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
|
55
|
|
- selector: 'page-chat',template:/*ion-inline-start:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/'<!--\n Generated template for the ChatPage page.\n\n See http://ionicframework.com/docs/components/#navigation for more info on\n Ionic pages and navigation.\n-->\n<ion-header>\n\n <ion-navbar>\n <ion-title>chatPage</ion-title>\n </ion-navbar>\n\n</ion-header>\n<!-- *ngFor="let m of msg">{{ m }} -->\n\n<ion-content padding >\n <div *ngFor="let m of msg">\n {{ m.message }}\n </div>\n\n <form #test1="ngForm" ng-submit="send(test1.value)">\n <ion-textarea type="text" name="message" [(ngModel)]="test" ></ion-textarea>\n <button ion-button (click)="send(test1.value)"(click)="getMessages()">send</button>\n </form>\n</ion-content>\n'/*ion-inline-end:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/,
|
|
62
|
+ selector: 'page-chat',template:/*ion-inline-start:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/'<!--\n Generated template for the ChatPage page.\n\n See http://ionicframework.com/docs/components/#navigation for more info on\n Ionic pages and navigation.\n-->\n<ion-header>\n\n <ion-navbar>\n <ion-title>chatPage</ion-title>\n </ion-navbar>\n\n</ion-header>\n<!-- *ngFor="let m of msg">{{ m }} -->\n\n<ion-content padding >\n <div *ngFor="let m of msg" class="message-wrapper">\n <div class="name">Nhu <span class="timestamp">4/10</span></div>\n <div class="message">{{m.message}}</div>\n </div>\n\n <form #test1="ngForm" ng-submit="send(test1.value)">\n <ion-textarea type="text" name="message" [(ngModel)]="test" class="user-message"></ion-textarea>\n <button ion-button (click)="send(test1.value)" >send</button>\n </form>\n</ion-content>\n'/*ion-inline-end:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/,
|
56
|
63
|
}),
|
57
|
|
- __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */]) === "function" && _a || Object, typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */]) === "function" && _b || Object, typeof (_c = typeof __WEBPACK_IMPORTED_MODULE_2__providers_message_service_message_service__["a" /* MessageServiceProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_2__providers_message_service_message_service__["a" /* MessageServiceProvider */]) === "function" && _c || Object])
|
|
64
|
+ __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */], __WEBPACK_IMPORTED_MODULE_2__providers_message_service_message_service__["a" /* MessageServiceProvider */]])
|
58
|
65
|
], ChatPage);
|
59
|
66
|
return ChatPage;
|
60
|
|
- var _a, _b, _c;
|
61
|
67
|
}());
|
62
|
68
|
|
63
|
69
|
//# sourceMappingURL=chat.js.map
|
|
@@ -288,10 +294,9 @@ var MessageServiceProvider = /** @class */ (function () {
|
288
|
294
|
};
|
289
|
295
|
MessageServiceProvider = __decorate([
|
290
|
296
|
Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */])(),
|
291
|
|
- __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_0__angular_common_http__["a" /* HttpClient */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_0__angular_common_http__["a" /* HttpClient */]) === "function" && _a || Object])
|
|
297
|
+ __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_common_http__["a" /* HttpClient */]])
|
292
|
298
|
], MessageServiceProvider);
|
293
|
299
|
return MessageServiceProvider;
|
294
|
|
- var _a;
|
295
|
300
|
}());
|
296
|
301
|
|
297
|
302
|
//# sourceMappingURL=message-service.js.map
|