Pārlūkot izejas kodu

user profile name and summary populating

Rachelle 6 gadus atpakaļ
vecāks
revīzija
6b40145a0d

+ 0
- 7
MyPassionProjectClient/src/pages/login/login.ts Parādīt failu

@@ -2,13 +2,6 @@ import { Component } from '@angular/core';
2 2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3 3
 import {MenuPage} from "../menu/menu";
4 4
 
5
-/**
6
- * Generated class for the LoginPage page.
7
- *
8
- * See https://ionicframework.com/docs/components/#navigation for more info on
9
- * Ionic pages and navigation.
10
- */
11
-
12 5
 @IonicPage()
13 6
 @Component({
14 7
   selector: 'page-login',

+ 2
- 8
MyPassionProjectClient/src/pages/profile/profile.html Parādīt failu

@@ -1,9 +1,3 @@
1
-<!--
2
-  Generated template for the HomePage page.
3
-
4
-  See http://ionicframework.com/docs/components/#navigation for more info on
5
-  Ionic pages and navigation.
6
--->
7 1
 <ion-header>
8 2
 
9 3
   <ion-navbar>
@@ -29,10 +23,10 @@
29 23
 
30 24
     <ion-card-content>
31 25
       <ion-card-title>
32
-        Xomi
26
+        {{user.profileName}}
33 27
       </ion-card-title>
34 28
       <p>
35
-        Always up for a good strategy game! Currently obsessed with Dominion.
29
+        {{user.summary}}
36 30
       </p>
37 31
     </ion-card-content>
38 32
 

+ 5
- 11
MyPassionProjectClient/src/pages/profile/profile.ts Parādīt failu

@@ -1,12 +1,6 @@
1 1
 import { Component } from '@angular/core';
2 2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3
-
4
-/**
5
- * Generated class for the HomePage page.
6
- *
7
- * See https://ionicframework.com/docs/components/#navigation for more info on
8
- * Ionic pages and navigation.
9
- */
3
+import { UsersService } from '../../providers/users-service';
10 4
 
11 5
 @IonicPage()
12 6
 @Component({
@@ -14,13 +8,13 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
14 8
   templateUrl: 'profile.html',
15 9
 })
16 10
 export class ProfilePage {
11
+  user: any;
17 12
 
18
-  constructor(public navCtrl: NavController, public navParams: NavParams) {
13
+  constructor(public navCtrl: NavController, public navParams: NavParams, public usersService: UsersService) {
14
+    this.user = this.usersService.getUserById().subscribe(user=>this.user = user);
19 15
   }
20 16
 
21
-  ionViewDidLoad() {
22
-    console.log('ionViewDidLoad ProfilePage');
17
+  ionViewDidLoad() { 
23 18
   }
24
-
25 19
 }
26 20
  

+ 2
- 6
MyPassionProjectClient/src/providers/users-service.ts Parādīt failu

@@ -10,11 +10,7 @@ export class UsersService{
10 10
   constructor(public http: HttpClient){
11 11
   }
12 12
 
13
-  getAllUsers(): Observable<any> {
14
-    return this.http.get(this.USERS_API);
15
-  }
16
-
17
-  getUserById(id: String) {
18
-      return this.http.get(this.USERS_API+id)
13
+  getUserById() {
14
+      return this.http.get(this.USERS_API+"/1")
19 15
   }
20 16
 }