I you want to put the response of the request in the navItems
. Because http.get()
return an observable you will have to subscribe to it.
Look at this example:
// version without map_x000D_
this.http.get("../data/navItems.json")_x000D_
.subscribe((success) => {_x000D_
this.navItems = success.json(); _x000D_
});_x000D_
_x000D_
// with map_x000D_
import 'rxjs/add/operator/map'_x000D_
this.http.get("../data/navItems.json")_x000D_
.map((data) => {_x000D_
return data.json();_x000D_
})_x000D_
.subscribe((success) => {_x000D_
this.navItems = success; _x000D_
});
_x000D_