The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

john_seattle (17) [Avatar] Offline
#1
Working through Chapter 7 code I found that the JSON data file must
be placed into the "/assets" folder. Also the data image links need to
have imageUrl's prefixed with "/assets/img/" not "data/img/". Thus,
the product.service.ts file references will change to
'/assets/products.json'.

-John from Seattle
Yakov Fain (219) [Avatar] Offline
#2
john_seattle (17) [Avatar] Offline
#3
I believe I found the reason that the data was not being accessed in the "/src/data"
folder. As I just read in book section 12.2, you declare in the angular-cli.json
(or angular.json file for Angular 6) the application "assets" as the following:

"assets": [
"src/assets",
"src/data",
"src/favicon.ico"
]

Since I built my application from scratch I did not have the "src/data" line
in my angular.json file. So including this line should allow data to be
read from the data folder. I'll try it out.

- John W. from Seattle
rodkar (4) [Avatar] Offline
#4
@john_seattle,

Thank you for your post and solution. I have run into the same problem even with the src/data declared inside angular.json. Just wondering if you have better luck putting src/data inside angular.json.


john_seattle wrote:I believe I found the reason that the data was not being accessed in the "/src/data"
folder. As I just read in book section 12.2, you declare in the angular-cli.json
(or angular.json file for Angular 6) the application "assets" as the following:

"assets": [
"src/assets",
"src/data",
"src/favicon.ico"
]

Since I built my application from scratch I did not have the "src/data" line
in my angular.json file. So including this line should allow data to be
read from the data folder. I'll try it out.

- John W. from Seattle