sadique
sadique

Reputation: 15

Ionic 2 mobilefirst 8.0 adapter call not working in browser

I am invoking a procedure on mobilefirst 8.0 adapter from ionic 2 I am able to see the response in device but not in chrome.Got the below error ReferenceError: WLResourceRequest is not defined.Below is my code

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { TransitPage } from '../transit/transit';
import { TrackDartPage } from '../track-dart/track-dart';
import { LocationFinderPage } from '../location-finder/location-finder';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';
declare var WLResourceRequest;
calladapter(){
    var resourceRequest = new WLResourceRequest("/adapters/trackDart/status/" + 2,WLResourceRequest.GET);
    resourceRequest.send().then((response) => {
    alert(JSON.stringify(response.responseText));
    },
    function(error){
       alert(JSON.stringify(error));
    });
  }

Upvotes: 0

Views: 499

Answers (1)

Prerak Tiwari
Prerak Tiwari

Reputation: 3466

By the error I suspect that you are running ionic serve which is leading you to this error since ionic does not know about MobileFirst. Instead, run mfpdev app preview after running npm run watch command.

Upvotes: 1

Related Questions