AngularM AngularM - 1 month ago 5
AngularJS Question

I need to do a http request to a mail chimp subscription list via a component post

I need to do a http request to a mail chimp subscription list via a component post

I've read the mail chimp documentation and couldnt find anything on this.
I also tried their mail chimp embedded form in an angular 2 html5 view but that doesnt work for some weird reason.

So I've resulted to doing a http request to the subscribe list instead and I'm having trouble getting that working.

I'm using typescript, angular2 and mail chimp

This is my code so far:

subscribe = () => {
var url = "" +;
this.jsonp.request(url).subscribe(response => {

This is my current console log error in chrome:

Uncaught SyntaxError: Unexpected token <


I finally found out how to fix your issue. You need to use the Jsonp support of Angular2.

Your address supports Jsonp by adding a c query parameter to your URL and switching by You need to put the JSONP_CALLBACK value in it (see this issue:

In this case, you will have the following response payload:

  "result": "success",
  "msg": "Almost finished... We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you."

After having registered JSONP_PROVIDERS when calling the bootstrap function:

import {bootstrap} from 'angular2/platform/browser'
import {JSONP_PROVIDERS} from 'angular2/http'
import {AppComponent} from './app.component'

bootstrap(AppComponent, [ JSONP_PROVIDERS ]);

You can then execute your request using an instance of the Jsonp class you injected from constructor:

import {Component} from 'angular2/core';
import {Jsonp} from 'angular2/http';

  selector: 'my-app',
  template: `
      Result: {{result | json}}
export class AppComponent {
  constructor(jsonp:Jsonp) {
    var url = '';
    jsonp.request(url, { method: 'Get' })
     .subscribe((res) => {
       this.result = res.json()

See this plunkr for a working sample: