![](/img/trans.png)
[英]Operator '>' cannot be applied to types 'boolean' and 'number'?
[英]Operator '>' cannot be applied to types 'boolean' and '{ return: Observable<any>; }' error
我目前正在關注 Angular 教程,我在服務組件中遇到了這個錯誤。
這是我的代碼:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class NgserviceService {
constructor(private http:HttpClient) {
fetchProductListFromRemote():Observable<any> {
return this.http.get<any>("localhost:8083/getproductlist");
}
}
}
您不能在構造函數中編寫方法。 在 fetchProductListFromRemote 方法之前關閉構造函數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.