import { Component, OnInit, Input } from '@angular/core'; import { PrivilegeConstants } from '../../../constants/privilege.constants'; import { ProfileService } from '../../../services/profile.service'; import { Profile } from '../profile.model'; @Component({ selector: 'app-profile-assign', templateUrl: './profile-assign.component.html', styleUrls: ['./profile-assign.component.css'] }) export class ProfileAssignComponent implements OnInit { profiles: Profile[]; profile: Profile; profileId: number = 0; isView: boolean; userId: number; userViewPrivilege = PrivilegeConstants.USER_LIST_VIEW; @Input() user: any; constructor(private profileService: ProfileService) {} ngOnInit() { this.init(); } init(): void { console.log("init::",this.user); if(this.user!=null){ this.getProfiles(); } } getProfiles(): void { this.profileService.get().subscribe(data => { this.profiles = data; console.log(data); }); } selectOption(id: number): void { console.log(id); this.profileId = id; this.user.profile= {id:id}; console.log("user::",this.user); } }