było wiele pytań o "mapa nie jest funkcją", ale prawie wszyscy po prostu nie zaimportowali biblioteki rxjs.mapa nie jest funkcją (Rxjs) mimo importowania
W moim przypadku importuję, ale błąd nadal istnieje.
pracuję z jońskich 2 iw ten sposób moje zależności package.json wyglądać następująco:
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/compiler-cli": "0.6.2",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/platform-server": "2.0.0",
"@ionic/storage": "1.0.3",
"ionic-angular": "2.0.0-rc.1",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12"
}
Tak to jest, jak tworzę moją usługę:
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions, Response } from '@angular/http';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/map';
@Injectable()
export class LoginService {
constructor(private http: Http) {
}
private dataUrl = '/node';
getData() : any {
this.http.get(this.dataUrl)
.map(response => response.json())
.subscribe(result => console.log(result));
}
}
Próbowałem też ponownie zainstalować moduł rxjs, ale wciąż nie ma sukcesu. Może jest niekompatybilny z wersją jonową 2 lub aktualną wersją kątową?
Co myślicie chłopaki?
Cheers,
Andrej
Czy możesz wyświetlić cały komunikat o błędzie? – martin
spróbuj z tym również 'import 'rxjs/Rx'' – micronyks