Closed tekix closed 7 years ago
Will check into this and come back with the answer.
@itryan it does work for me without including rxjs/add/operator/map
at all. Can you try the new version?
Thanks @jkuri , I moved the import 'rxjs/add/operator/map'
to main.ts
or /src/app/app.module.ts
and now it works.
When putting it in vendor.ts
it compiled successfully but got run time error if trying to use the map function
TypeError: this.http.get(...).map is not a function ...
// DemoComponent.ts
export class DemoComponent {
constructor(private http: Http) {
}
// ...
getData() {
return this.http.get(this.url).map(rspn => {
let data = rspn.json().data;
return data;
})
.subscribe(data => {
// ...
});
}
}
I have for example imported import { Observable } from 'rxjs'
and works, looks like it just need to be included somewhere in source files or main.ts
. Closing.
In webpack I can use the following code to include the rxjs map operator:
Is there any solution to include the rxjs operator in one place, so no need to import the operator in every file that uses it?