Observable<{}> not assignable to type Observable

前端 未结 5 1008
自闭症患者
自闭症患者 2020-12-08 10:04

I\'m learning Angular2 and Typescript. I\'m working through the Heroes tutorial on angular.io, but applying it to a project I\'m converting from ASP.Net. I\'ve run into a pr

5条回答
  •  误落风尘
    2020-12-08 10:25

    I found the next: AccessTokens was missing. So,i made the change and it workted: On your model (in my case Country) edit de file and change from:

    export interface CountryInterface {
      "id"?: any;
      "name": string;
      "order"?: number;  
    }
    
    export class Country implements CountryInterface {
      "id": any;
      "name": string;
      "order": number;
       ....
    }
    

    To:

    export interface CountryInterface {
      "id"?: any;
      "name": string;
      "order"?: number;
      accessTokens: any[];
    }
    
    export class Country implements CountryInterface {
      "id": any;
      "name": string;
      "order": number;
      accessTokens: any[];
      ...
    }
    

提交回复
热议问题