E
E
Emptyform2017-02-27 00:42:37
Angular
Emptyform, 2017-02-27 00:42:37

How to force compiled Angular2 project to take settings from json file?

Hey!
There is a project on Angelar2. The settings are placed in a separate JSON file. When compiling (ng build), the content is pushed into a bundle (main.bundle.js).
Question - can I somehow do it so that JSON is not stuffed into the bundle, and the application takes the settings from the JSON file during operation?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
ozknemoy, 2017-02-27
@Emptyform

in the first angular there was a $http.json method. in the second it also seems to be there: this.http.get('app/heroes.json')

C
cha-cha, 2017-02-27
@cha-cha

You can push json to a public directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question