I am having trouble getting a jsonp request working with Angular 2.  I 
can't seem to get the response value.  Below is the code I am using:

import {Injectable} from 'angular2/core';
import {HtmlPages} from './objects';
//import {Http, Headers, Jsonp, Request, JSONP_PROVIDERS, JSONPBackend} 
from 'angular2/http';
import {Http, Headers, RequestMethod } from 'angular2/http';
import 'rxjs/add/operator/map';

@Injectable()
export class HTMLService {
    htmlpages: Object;
    http: Http;
    constructor(http: Http) {
        this.http = http;
    }

    getPages() {
        console.log("123456");
        console.log("12345678");
        var xxx = '';
        var jsonheaders = new Headers();
        jsonheaders.append('Accept', '*/*');
        jsonheaders.append('Content-Type', 'application/javascript');
        
this.http.request('http://jnsaber.thepulsenetwork.com/PlatformApi/api/HtmlPage/?API_Key=C57C4E7C-1BFF-41E2-B6B2-38F69B6E2563&campaign_key=184D58DD-EBC1-E411-9410-0050569A378E&mode=HTMLPages',
 
{ headers: jsonheaders, method: 'Get' }).subscribe(res => { this.htmlpages 
= res.text });
        console.log(this.htmlpages);
    }
     
    //   return 
this.jsonp.request('http://jnsaber.thepulsenetwork.com/PlatformApi/api/HtmlPage/?API_Key=C57C4E7C-1BFF-41E2-B6B2-38F69B6E2563&campaign_key=184D58DD-EBC1-E411-9410-0050569A378E&mode=HTMLPages&callback=JSON_CALLBACK')
    //.map(JSON_CALLBACK => JSON_CALLBACK.json());        
    //}

} 


If I include the "Content-Type" as part of the request, I gets sent with 
the method of "Option" and not "Get".  If I use the jsonp method which I 
have commented out, I get a "No provider for ConnectionBackend".

Any help would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to