2
doSelectMessagesAttributesUrl1(pushRequest : PushRequest) {
    console.info("sending post request");

    let headers = new Headers({
        'Content-Type': 'application/x-www-form-urlencoded'});

    return this.http
        .post(this.selectMessagesAttributesUrl, {headers: headers})
        .map(res => res.json().data)
        .subscribe(
            data => { },
            err => { console.error('An error occurred', err) }
        );
}

I get this error:

EXCEPTION: TypeError: this.http.post(...).map is not a functionBrowserDomAdapter.logError @ platform-browser.umd.js:937
zone.js:461 

Unhandled Promise rejection: this.http.post(...).map is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: this.http.post(...).map is not a function(…)

what is missing in my http syntax?

Elad Benda
  • 35,076
  • 87
  • 265
  • 471

1 Answers1

4

You need to import rxjs like

import 'rxjs/Rx';
Jorawar Singh
  • 7,463
  • 4
  • 26
  • 39
  • 1
    i have this already, and yet i see this error – Elad Benda Aug 21 '16 at 07:09
  • Be aware this usage of import will drastically increase bundle size – Tomas Jul 19 '18 at 18:11
  • // ----------------- map ----------------------- import 'rxjs/add/operator/map'; import { map } from 'rxjs/operators'; import 'rxjs/Rx'; import { Observable } from 'rxjs'; import 'rxjs/add/observable/throw'; – Techdive Nov 28 '18 at 05:30