【发布时间】:2017-05-11 13:11:19
【问题描述】:
在我的服务中,我使用的是http 帖子。我想将 URL 设置为常量。
return this.http.get(this.config.API_URL+'users', options).map(res=>res.json());
我尝试了一项服务:
import {Injectable} from '@angular/core';
@Injectable()
export class AppService {
API_URL :String;
constructor() {
this.API_URL = 'some url';
}
}
还有没有其他方法可以在 Angular4 中创建一个常量值?
【问题讨论】:
标签: angular