I have a tiny demo and it attempts to read app/data.json
using the Angular HttpClient.
const post$:Observable =
i think there are some issues about reading local json in stackblitz it doesn't return plain json just the index.html instead. but another way is mocking a request from local json, you can try:
import data from './data.json'
ngOnInit(){
this.getDatas().subscribe(data=>{
console.log(data)
})
}
getDatas():Observable{
return of(data).pipe(delay(1000));
}
forked DEMO