Cannot find referecnce to WLResourceRequest in Ionic 2 App

↘锁芯ラ 提交于 2019-12-24 16:50:35

问题


I created a provider in Ionic 2 (v 2.0.0-beta.32) App powered by IBM MobileFirst Platform 8.0 (mfpdev verion 8.0.0-2016070716) Beta. Following is the code:

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';

@Injectable()
export class EmployeeService {
  data: any;

  constructor() {
    this.data = null;
  }

  load() {
    console.log('--> called employee service');
    if (this.data) {
      // already loaded data
      return Promise.resolve(this.data);
    }

    // don't have the data yet
    return new Promise(resolve => {
    let dataRequest = new WLResourceRequest("/adapters/messangerAdapter/getEmployeeRating",WLResourceRequest.GET);
      /*dataRequest.send().then((response) => {
        console.log('--> adapter response recieved', response.responseJSON.results);
        this.data = response.responseJSON.results;
        resolve(this.data);
      });*/
    });
  }
}

When I am compiling the code I am getting the following error:

TypeScript error: E:/Worklight Mobile App/MFP 8.0 Eclipse and WS/workspace/MobileApp/TestProject/app/providers/employee-service/employee-service.ts(30,94): Error TS2304: Cannot find name 'WLResourceRequest'.

I have added the mfp plugin to the ionic project. Is there something else i have to do in order to make that work?


回答1:


Can you try adding this as first line of your file? (Before import)

/// <reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />


来源:https://stackoverflow.com/questions/38356571/cannot-find-referecnce-to-wlresourcerequest-in-ionic-2-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!