Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit,OnDestroy } from '@angular/core';
- import { RegisterService } from '../../services/register/register.service';
- import { ChatService } from '../../services/chat/chat.service';
- import { ContactListService } from '../../services/contact-list/contact-list.service';
- import { ProfilService } from '../../services/profil/profil.service';
- import { User } from '../../../User';
- //import { Router } from '@angular/router';
- import { ActivatedRoute } from '@angular/router';
- import {ContactList} from "../contact-list/contact-list.component";
- import {ChatComponent} from "../chat/chat.component";
- import 'rxjs/add/operator/toPromise';
- @Component({
- moduleId: module.id,
- selector: 'profilUser',
- templateUrl: 'profilUser.component.html',
- providers: [ProfilService,ChatService,ContactListService,ChatComponent,ContactList]
- })
- export class ProfilUserComponent implements OnDestroy {
- //initialisation de notre classe/modele User/ts
- user : User;
- email : string;
- pseudo : string;
- pseudoTest : string;
- pseudoMe : string;
- picture :string;
- bio:string;
- status:string;
- birthday:string;
- //contactFindProfil:User;
- connection;
- constructor(private profilService:ProfilService, private registerService:RegisterService,private contactListService:ContactListService, private contactList:ContactList,private route:ActivatedRoute){
- //this.pseudoTest = this.contactList.sendContact();
- this.user = {
- _id: '',
- pseudo: '',
- email: '',
- password: '',
- picture: '',
- bio:'',
- birthday:new Date(''),
- status:'',
- exist:true
- }
- this.route.params.subscribe(params => {
- this.pseudoTest = params['userPseudo'];
- this.pseudoMe = params['me'];
- this.profilService.getContactUser(this.pseudoTest).then(contactFind=>{
- console.log("contact-list component : "+contactFind.pseudo);
- this.user = contactFind;
- this.user.picture = contactFind.picture;
- });
- });
- console.log("pseudoTest dans profil User: "+this.pseudo);
- }
- ngOnDestroy() {
- if(this.connection){
- this.connection.unsubscribe();
- }
- //this.router.navigate(['/profil']);
- }
- }
Add Comment
Please, Sign In to add comment