我按照这种方式执行此操作:
使用HttpClient和这段代码:this.http.get(" url / assets / file.json");
但是,如果我的配置文件位于assets文件夹中,我的信息将打开到网络。
如何在内部文件夹(而非资产)中读取此文件?
答案 0 :(得分:1)
如果你把你的配置文件和environment.ts一样怎么办?您的配置文件将像其他ts文件一样进行编译。
您只需创建一个打字稿文件并在变量中添加您的配置:
export const myconfig = 'your config here';
并且你不需要为它调用http,只是;
import { myconfig } from 'your_config_file'