【发布时间】:2020-12-27 00:14:42
【问题描述】:
对不起,如果这是一个明显的问题。 我正在关注本教程:https://blog.angular-university.io/angular-jwt-authentication/
我像教程中一样创建了服务,但它告诉我“可观察”类型上不存在属性“.shareReplay”,我想我的导入不正确,但我似乎找不到正确的。
import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {User} from "./model/user";
@Injectable({
providedIn: 'root'
})
export class AuthenticationService {
constructor(private http: HttpClient) {
}
login(username: string, password: string){
return this.http.post<User>('/login', {username, password})
.shareReplay();
}
}
【问题讨论】:
标签: angular typescript angular-httpclient