How to convert Observable to array[]

后端 未结 4 1785
暗喜
暗喜 2020-12-05 04:13

I have following method in typescript, I need to bind to angular grid

CountryService

GetCountries()  {
  return this.http.get(`http         


        
4条回答
  •  忘掉有多难
    2020-12-05 05:04

    You will need to subscribe to your observables:

    this.CountryService.GetCountries()
        .subscribe(countries => {
            this.myGridOptions.rowData = countries as CountryData[]
        })
    

    And, in your html, wherever needed, you can pass the async pipe to it.

提交回复
热议问题