我正在使用离子2开发Android应用程序。它给了我打字稿错误:属性'结果'在类型'{}'上不存在

时间:2017-08-17 17:27:50

标签: typescript

这是我的代码:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { DetailsPage } from '../details/details';
import {RequestService} from '../../providers/request-service';
import { HttpModule} from '@angular/http';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';


@IonicPage()
@Component({
selector: 'page-request',
templateUrl: 'request.html',
providers: [RequestService]
})
export class RequestPage {
  public items : any = [];
  public ngo : any = [];
  public volunteer : any = [];
  public req: any;
  public Result: any = [];
  public page_name: any;
  public req_type: any;
  public start:number=5;
  public count: any;
  public old_count: any;
  public profile_type: any;
  constructor(public navCtrl: NavController, public navParams: NavParams, private http   : Http, public requestService: RequestService)
  { 

    this.req = navParams.get('request_type');
    switch(this.req) 
    { 
       case "complete": {  
          this.requestCompletedNgo();
          this.page_name = 'COMPLETED REQUESTS';
          break; 
       } 
       case "open": { 
          this.requestOpenNgo();
          this.page_name = 'OPEN REQUESTS';
          break; 
       } 
    }

  }


  requestCompletedNgo()
  { 
    this.old_count=this.items.length;
    this.profile_type='complete_ngo';
    this.requestService.loadComplete(this.start).then(data => 
    {   
        this.items = data.Result.ngo;
        this.req_type = 'complete';
        this.count=this.items.length;
        //alert(JSON.stringify(this.items));
    });
  }
}

我正在使用离子2开发Android应用程序 它给了我打字稿错误:属性'结果'在类型'{}'上不存在我正在使用离子2来开发一个Android应用程序。
它给了我打字稿错误:属性'结果'在类型'{}'上不存在

这是我的数组结构:

"Result":{"ngo":[{"request_id":"1"},{"request_id":"2"},{"request_id":"3"}],          
"volunteer":[{"request_id":"101"},{"request_id":"102"},{"request_id":"103"}]}

0 个答案:

没有答案