This is how i'm fetching a single JSON value inside my template .. My application route :
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return { url:"myurl" };
},setupController(controller,model)
{
controller.set("URL",model.url);
}
});
application.hbs :
<h1></h1>
This works fine. What I want to do now is to fetch the values from this kind of JSON object into my template :
{"employee":
[{
"id":"1001",
"name":"Employee1",
"address":{
"Street":"25 West Street",
"city":"City1",
"state":"State1",
"Country":"US"
}
}
]}
-
What Code should I be using in my application route to set the controller?
-
How do i retrieve the value of each and every key in my JSON object into my template?
-
Is there a way to fetch not only the value of the JSON object, but also its key inside my template ? If so, how?
Aucun commentaire:
Enregistrer un commentaire