Guest User

Untitled

a guest
Jun 5th, 2017
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. import { Component, OnInit,OnDestroy } from '@angular/core';
  2. import { RegisterService } from '../../services/register/register.service';
  3. import { ChatService } from '../../services/chat/chat.service';
  4. import { ContactListService } from '../../services/contact-list/contact-list.service';
  5. import { ProfilService } from '../../services/profil/profil.service';
  6. import { User } from '../../../User';
  7. //import { Router } from '@angular/router';
  8. import { ActivatedRoute } from '@angular/router';
  9. import {ContactList} from "../contact-list/contact-list.component";
  10. import {ChatComponent} from "../chat/chat.component";
  11. import 'rxjs/add/operator/toPromise';
  12.  
  13. @Component({
  14. moduleId: module.id,
  15. selector: 'profilUser',
  16. templateUrl: 'profilUser.component.html',
  17. providers: [ProfilService,ChatService,ContactListService,ChatComponent,ContactList]
  18. })
  19.  
  20. export class ProfilUserComponent implements OnDestroy {
  21. //initialisation de notre classe/modele User/ts
  22.  
  23. user : User;
  24. email : string;
  25. pseudo : string;
  26. pseudoTest : string;
  27. pseudoMe : string;
  28. picture :string;
  29. bio:string;
  30. status:string;
  31. birthday:string;
  32. //contactFindProfil:User;
  33. connection;
  34. constructor(private profilService:ProfilService, private registerService:RegisterService,private contactListService:ContactListService, private contactList:ContactList,private route:ActivatedRoute){
  35. //this.pseudoTest = this.contactList.sendContact();
  36. this.user = {
  37. _id: '',
  38. pseudo: '',
  39. email: '',
  40. password: '',
  41. picture: '',
  42. bio:'',
  43. birthday:new Date(''),
  44. status:'',
  45. exist:true
  46. }
  47.  
  48. this.route.params.subscribe(params => {
  49. this.pseudoTest = params['userPseudo'];
  50. this.pseudoMe = params['me'];
  51.  
  52.  
  53. this.profilService.getContactUser(this.pseudoTest).then(contactFind=>{
  54. console.log("contact-list component : "+contactFind.pseudo);
  55. this.user = contactFind;
  56. this.user.picture = contactFind.picture;
  57. });
  58. });
  59.  
  60. console.log("pseudoTest dans profil User: "+this.pseudo);
  61. }
  62. ngOnDestroy() {
  63. if(this.connection){
  64. this.connection.unsubscribe();
  65. }
  66. //this.router.navigate(['/profil']);
  67. }
  68.  
  69.  
  70.  
  71. }
Add Comment
Please, Sign In to add comment