I created an ember demo,A parent view and it's child this is the parent view
<h1>A list of Todo Tasks</h1>
<ul>
<li></li>
</ul>
and Its js login is import Ember from 'ember';
export default Ember.Route.extend({
model (){
return [{
"id" : 1,
"desc" : "Try use ember"
},
{
"id" : 2,
"desc" : "Add it to github"
},
];
}
});
but when i use the link-to and navigate the data didn't show unless i refresh the page This is the child view
<h2>The Details for <span style="color: green;"></span> is : </h2>
<p></p>
<ul>
<li></li>
</ul>
and its js logic
import Ember from 'ember';
export default Ember.Route.extend({
model(params){
if(params.id == "1"){
return {
name : "Ember SetUp",
steps : [{
id :1,
do : "Download Ember Cli"
},
{
id :2,
do : "Generate New Project"
},
{
id :3,
do : "Generate Pages&Routes"
}
]
};
}
else{
return {
error : true,
name : "Not Found",
message : "There is no task with this id"
}
}
}
});
iam using ember 2.5 and this is part of the router
this.route('todos', function() {
this.route('details',{path : "/:id"});
});
Aucun commentaire:
Enregistrer un commentaire