Kaynağa Gözat

messages posting

alizalang 6 yıl önce
ebeveyn
işleme
b2dd1ce63e

+ 1
- 1
ZipTeamOrange-ionic-UI/.sourcemaps/main.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 6
- 2
ZipTeamOrange-ionic-UI/src/pages/chat/chat.html Dosyayı Görüntüle

@@ -11,11 +11,15 @@
11 11
   </ion-navbar>
12 12
 
13 13
 </ion-header>
14
-
14
+<!-- *ngFor="let m of msg">{{ m }} -->
15 15
 
16 16
 <ion-content padding >
17
+  <div *ngFor="let m of msg">
18
+    {{ m.message }}
19
+  </div>
20
+
17 21
   <form  #test1="ngForm" ng-submit="send(test1.value)">
18 22
     <ion-textarea  type="text" name="message" [(ngModel)]="test" ></ion-textarea>
19
-    <button ion-button (click)="send(test1.value)">send</button>
23
+    <button ion-button (click)="send(test1.value)"(click)="getMessages()">send</button>
20 24
   </form>
21 25
 </ion-content>

+ 15
- 1
ZipTeamOrange-ionic-UI/src/pages/chat/chat.ts Dosyayı Görüntüle

@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
2 2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3 3
 import { NgForm } from '../../../node_modules/@angular/forms';
4 4
 import { MessageServiceProvider } from '../../providers/message-service/message-service';
5
+import { Message } from '../../../node_modules/@angular/compiler/src/i18n/i18n_ast';
5 6
 
6 7
 /**
7 8
  * Generated class for the ChatPage page.
@@ -17,16 +18,29 @@ import { MessageServiceProvider } from '../../providers/message-service/message-
17 18
 })
18 19
 export class ChatPage {
19 20
   test: any;
21
+  msg: any;
22
+  messages: Message [];
20 23
   constructor(public navCtrl: NavController, public navParams: NavParams, public messageApi: MessageServiceProvider) {
21 24
   }
22 25
 
23 26
   ionViewDidLoad() {
24 27
     console.log('ionViewDidLoad ChatPage');
28
+    this.getMessages();
25 29
   }
26 30
 
27 31
   send(createAccountInfo: NgForm){
28 32
     console.log("clicked");
29 33
     console.log(createAccountInfo)
30 34
     this.messageApi.saveMessage(createAccountInfo).subscribe(console.log);
35
+    this.getMessages()
31 36
   }
32
-}
37
+
38
+  getMessages(){
39
+    this.messageApi.getMessages().subscribe(data => {
40
+      this.msg = data
41
+      console.log(data)
42
+    });
43
+    this.test = this.messageApi.getCurrentMessage();
44
+  }
45
+
46
+}

+ 7
- 1
ZipTeamOrange-ionic-UI/src/providers/message-service/message-service.ts Dosyayı Görüntüle

@@ -1,6 +1,7 @@
1 1
 import { HttpClient } from '@angular/common/http';
2 2
 import { Injectable } from '@angular/core';
3 3
 import { Observable } from 'rxjs';
4
+import { Message } from '../../Classes/Messsage';
4 5
 
5 6
 /*
6 7
   Generated class for the MessageServiceProvider provider.
@@ -11,12 +12,17 @@ import { Observable } from 'rxjs';
11 12
 @Injectable()
12 13
 export class MessageServiceProvider {
13 14
 
15
+  messages = [];
14 16
   constructor(public http: HttpClient) {
15 17
     console.log('Hello MessageServiceProvider Provider');
16 18
   }
17 19
 
18 20
   getMessages(){
19
-    return this.http.get('http:localhost:8080/messages')
21
+    return this.http.get('http://localhost:8080/message/all');
22
+  }
23
+
24
+  getCurrentMessage(){
25
+    return this.messages;
20 26
   }
21 27
 
22 28
   saveMessage(createAccountInfo: any) : Observable<Object> {

+ 20
- 4
ZipTeamOrange-ionic-UI/www/build/main.js Dosyayı Görüntüle

@@ -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

+ 1
- 1
ZipTeamOrange-ionic-UI/www/build/main.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
ZipTeamOrange-ionic-UI/www/build/vendor.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle