I am new to angular, I tried below i got the response and got in console. but i try to check variable this.users it's coming as undefined in console. I want to assign the service response to this.users. but i am not getting. below is my code.
constructor(private dataService: DataService,private fb: FormBuilder) {
    dataService.getList().subscribe(res => console.log(res)); //works
    this.users=dataService.getList().subscribe(res => this.test=res); 
    console.log(this.users); //undefined
}
how to assign service response to variable, that variable i am using in ngOnInit, please tell me how to do
 
    