我需要获取api.openweathermap.org的IP地址。
这是我尝试过的:
import { Injectable } from '@angular/core';
import { Product } from './product.model';
import { HttpClient } from "@angular/common/http";
@Injectable({
providedIn: 'root'
})
export class ProductService {
formData : Product;
list : Product[];
readonly rootURL = "http://localhost:57319/api";
constructor(private http : HttpClient) { }
postProduct(formData : Product){
return this.http.post(this.rootURL+'/Product',formData);
}
refreshList(){
this.http.get(this.rootURL+'/Product')
.toPromise().then(res => this.list = res as Product[]);
}
putProduct(formData : Product){
return this.http.put(this.rootURL+'/Product/'+formData.ProductID,formData);
}
deleteProduct(id : number){
return this.http.delete(this.rootURL+'/Product/'+id);
}
}
输出为随机字符串,例如“ ^ jk5”,应为82.196.7.246