Q
Q
Qairat2017-05-08 00:08:44
Angular
Qairat, 2017-05-08 00:08:44

How to fix Property 'includes' is missing in type error in angular 2?

Hello!
The following error comes out when compiling:
340f9a6880054ac4a26dfbe6d54eab3a.PNG
And here is my code:
chain.module.ts created interfaces

export interface EfficiencyOfAdditionalCostV1 {
    ReportDate: Date;
    ExtraProfitHour: number;
}
export interface EfficiencyOfAdditionalCostV4 {
    ChangeBNPMonth: number;
    ChangePPDay: number;
}

export interface EfficiencyOfAdditionalCostRes {
    EfficiencyOfAdditionalCost_V1: EfficiencyOfAdditionalCostV1[],
    EfficiencyOfAdditionalCost_V2: EfficiencyOfAdditionalCostV4[],
}

Then I added them to chain.service.ts
getEfficiencyOfAdditionalCostRes(): Promise<EfficiencyOfAdditionalCostRes> {
        return this.http.get(this.api.API_URL + 'Production/EfficiencyOfAdditionalCost?counter=3')
            .toPromise()
            .then(res => res.json()[0]);
    }

Then, now I want to use in components:
export class WidgetEfficiencyOfValueChainComponent extends WidgetComponent implements OnInit {
    data: EfficiencyOfAdditionalCostV4[] = [];

constructor(private servise: ChainModule){
}
ngOnInit() {
        this.service.getEfficiencyOfAdditionalCostRes().then(res => {
           this.data = res;
        });
}
}

There is an error in this.data=res,
I can not fix the error. Look please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question