What is the difference between import { map } from 'rxjs/operators'; and import 'rxjs/add/operator/map'; ?
I'm using it in the service method which does a login :
// import { map } from 'rxjs/operators'; // Fails at runtime
import 'rxjs/add/operator/map'; // Works fine at runtime
public login(username: string, password: string): Observable<any> {
console.log('Sending the login credentials to obtain a token');
const credentials = { 'email': username, 'password': password };
return this.httpService.postWithHeadersInResponse(URI_LOGIN, credentials)
.map((response: HttpResponse<any>) => {
const header = response.headers.get(this.authService.getHeaderName());
const token = this.authService.extractTokenFromHeader(header);
console.log('The token from the response header: ' + token);
this.authService.setJwtTokenToLocalStorage(token);
});
}