瀏覽代碼

scrollllsssss

David Thornley 6 年之前
父節點
當前提交
c1fac04f67

+ 3
- 2
zlg/ionic.config.json 查看文件

@@ -3,5 +3,6 @@
3 3
   "integrations": {
4 4
     "cordova": {}
5 5
   },
6
-  "type": "ionic-angular"
7
-}
6
+  "type": "ionic-angular",
7
+  "app_id": ""
8
+}

+ 3
- 3
zlg/src/pages/home/home.html 查看文件

@@ -21,9 +21,9 @@
21 21
     <button (click)="sendPost()" id="myVault-button18" style="font-weight:600;font-size:20px;" class="codystar button button-royal button-block button-small">Post</button>
22 22
   </div>
23 23
   
24
-  <div id="myVault-markdown4" class="show-list-numbers-and-dots overflow-box">
25
-      <div style="color:#FFFFFF;list-style-type: none;overflow: scroll;" *ngFor="let p of posts" >
26
-        <button (click)="goToUsersFeed(p)" class="button button-block" style="background-color:lightgray;text-align: left"><strong>{{ p.userName }}: </strong>{{ p.message }}</button>
24
+  <div id="myVault-markdown4" class="show-list-numbers-and-dots overflow-box" style="overflow-y: scroll; height: 55vh;">
25
+      <div style="color:#FFFFFF;list-style-type: none;" *ngFor="let p of posts">
26
+        <button (click)="goToUsersFeed(p)" class="button button-block" style="background-color:lightgray;text-align: left; word-wrap: break-word; white-space: normal"><strong>{{ p.userName }}: </strong>{{ p.message }}</button>
27 27
       </div>
28 28
   </div>
29 29
 </ion-content>

+ 8
- 0
zlg/src/pages/home/home.scss 查看文件

@@ -1,3 +1,11 @@
1 1
 page-home {
2 2
 
3
+    .my-ion-list {
4
+        max-height: 55vh;
5
+        overflow-y: scroll;
6
+      }
7
+      ion-list {
8
+          background-color: lightgray;
9
+      }
10
+
3 11
 }

+ 2
- 2
zlg/src/providers/post-service/post-service.ts 查看文件

@@ -1,6 +1,6 @@
1
-import { HttpClient, HttpResponse } from '@angular/common/http';
1
+import { HttpClient} from '@angular/common/http';
2 2
 import { Injectable } from '@angular/core';
3
-import { Observable } from 'rx';
3
+// import { Observable } from 'rxjs';
4 4
 
5 5
 /*
6 6
   Generated class for the PostServiceProvider provider.

+ 29
- 0
zlg/src/providers/rest/rest.ts 查看文件

@@ -0,0 +1,29 @@
1
+import { HttpClient } from '@angular/common/http';
2
+import { Injectable } from '@angular/core';
3
+
4
+/*
5
+  Generated class for the RestProvider provider.
6
+
7
+  See https://angular.io/guide/dependency-injection for more info on providers
8
+  and Angular DI.
9
+*/
10
+@Injectable()
11
+export class RestProvider {
12
+
13
+  apiUrl = 'https://fast-headland-39537.herokuapp.com';
14
+
15
+  constructor(public http: HttpClient) {
16
+    console.log('Hello RestServiceProvider Provider');
17
+  }
18
+
19
+  getPosts() {
20
+    return new Promise(resolve => {
21
+      this.http.get(this.apiUrl+'/posts/all').subscribe(data => {
22
+        resolve(data);
23
+      }, err => {
24
+        console.log(err);
25
+      });
26
+    });
27
+  }
28
+
29
+}