Difficulty finding list in the Angular?

0

Review the image below;

In my class of services it was like this;

 pesquisar(): Promise<any> {
        return this._http.get('${this.url}/menus' )
            .toPromise()
            .then(response => {
              response.json(); 
          })
    }

I just need to know how my method will stay in the component class;

I tried this way but I did not succeed, I need help;

 menu = [];


  public title: string;

  constructor(
    private _menuService: MenuAdminService
  ) {
      this.title = 'Lista de Cardápios';
    }

  ngOnInit() {

  this.pesquisar()
  }

   pesquisar(){

    this._menuService.pesquisar()
    .then(menu => {
      this.menu = menu;
      console.log(this.menu);

    });

  }
    
asked by anonymous 24.08.2018 / 14:28

0 answers