I got a problem when I tried to get value with http get services ..
services.ts :
  getLabelTByCode(code: string) {
    return this.http.get('/administration/typeByCode/'+code+'')
      .map((response :Response) => {
        return response.json();
      })
  }
component.ts
name : string;
getTypeByCode(code : string) {
    return this.adminService.getLabelTByCode(code)
      .subscribe(
        label => { 
          this.labelTypeOfDemand = label;
          // Here I can get the value of the name
          return this.labelTypeOfDemand.name;  
        }
      );
  }
saveFolder() { // When I submit my fomrs, I called this method
   this.name = this.getTypeByCode('XER');
   console.log(this.name); // ==> I got undefined
}
Why the value of name is undefined in method saveFolder ? How can I get the value ?
My JSON like :
{
      "id": 9,
      "code": "XER",
      "name": "TEST",
      "status": null
   },
      {
      "id": 7,
      "code": "PBA",
      "name": "TEST",
      "status": null
   },
