I'm using Angular 2.RC4 and typescript
I have class with data:
import {Injectable, Injector, ReflectiveInjector} from '@angular/core';
import {
Http, Response, Headers, RequestOptions, HTTP_PROVIDERS, Jsonp, JSONP_PROVIDERS,
URLSearchParams
} from '@angular/http';
import { Observable } from 'rxjs/Observable';
import '../helpers/rxjs-operators';
import { caaConfig } from "../config/cmsaa";
getData(url: string): Observable<any>{
let params = new URLSearchParams();
params.set('callback', 'JSONP_CALLBACK');
url = this.domain + url;
let cacheKey = 'cache_caa_http_get_' + url;
if(this._cache[cacheKey]){
return this._cache[cacheKey];
}else{
let request = this.jsonp.get(url, {search:params}).map(this.extractData).catch(this.handleError);
this._cache[cacheKey] = request;
return request;
}
}
In all sources: github issues, stackoverflow posts I saw that add callback parameter solve problem. In my case not.
My error is:
JSONP injected script did not invoke callback.
and url
http://example.com/project/invoices/4137?callback=ng_jsonp.__req0.finished
In my bootstrap in included JSON_PROVIDERS.
Someone have idea what I should fix to get data from my remote server?