|
@@ -34,19 +34,30 @@ var ChatPage = /** @class */ (function () {
|
34
|
34
|
}
|
35
|
35
|
ChatPage.prototype.ionViewDidLoad = function () {
|
36
|
36
|
console.log('ionViewDidLoad ChatPage');
|
|
37
|
+ this.getMessages();
|
37
|
38
|
};
|
38
|
39
|
ChatPage.prototype.send = function (createAccountInfo) {
|
39
|
40
|
console.log("clicked");
|
40
|
41
|
console.log(createAccountInfo);
|
41
|
42
|
this.messageApi.saveMessage(createAccountInfo).subscribe(console.log);
|
|
43
|
+ this.getMessages();
|
|
44
|
+ };
|
|
45
|
+ ChatPage.prototype.getMessages = function () {
|
|
46
|
+ var _this = this;
|
|
47
|
+ this.messageApi.getMessages().subscribe(function (data) {
|
|
48
|
+ _this.msg = data;
|
|
49
|
+ console.log(data);
|
|
50
|
+ });
|
|
51
|
+ this.test = this.messageApi.getCurrentMessage();
|
42
|
52
|
};
|
43
|
53
|
ChatPage = __decorate([
|
44
|
54
|
Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
|
45
|
|
- 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\n\n<ion-content padding >\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)">send</button>\n </form>\n</ion-content>\n'/*ion-inline-end:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/,
|
|
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"*/,
|
46
|
56
|
}),
|
47
|
|
- __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 */]])
|
|
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])
|
48
|
58
|
], ChatPage);
|
49
|
59
|
return ChatPage;
|
|
60
|
+ var _a, _b, _c;
|
50
|
61
|
}());
|
51
|
62
|
|
52
|
63
|
//# sourceMappingURL=chat.js.map
|
|
@@ -263,19 +274,24 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
263
|
274
|
var MessageServiceProvider = /** @class */ (function () {
|
264
|
275
|
function MessageServiceProvider(http) {
|
265
|
276
|
this.http = http;
|
|
277
|
+ this.messages = [];
|
266
|
278
|
console.log('Hello MessageServiceProvider Provider');
|
267
|
279
|
}
|
268
|
280
|
MessageServiceProvider.prototype.getMessages = function () {
|
269
|
|
- return this.http.get('http:localhost:8080/messages');
|
|
281
|
+ return this.http.get('http://localhost:8080/message/all');
|
|
282
|
+ };
|
|
283
|
+ MessageServiceProvider.prototype.getCurrentMessage = function () {
|
|
284
|
+ return this.messages;
|
270
|
285
|
};
|
271
|
286
|
MessageServiceProvider.prototype.saveMessage = function (createAccountInfo) {
|
272
|
287
|
return this.http.post("http://localhost:8080/message/add", createAccountInfo);
|
273
|
288
|
};
|
274
|
289
|
MessageServiceProvider = __decorate([
|
275
|
290
|
Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */])(),
|
276
|
|
- __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_0__angular_common_http__["a" /* HttpClient */]])
|
|
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])
|
277
|
292
|
], MessageServiceProvider);
|
278
|
293
|
return MessageServiceProvider;
|
|
294
|
+ var _a;
|
279
|
295
|
}());
|
280
|
296
|
|
281
|
297
|
//# sourceMappingURL=message-service.js.map
|