edit template not displaying on edit route

这一生的挚爱 提交于 2019-12-25 04:55:09

问题


I would like to edit users. I am following this tutorial: http://coding.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js/

I have a button in user.hbs to edit the user:

<button {{action "edit"}}>Edit</button> and below it is an {{outlet}}

When click it I'm directed to /index.html#/users/4/edit but my user.edit.hbs template does not show up

Here's userEditRoute.js:

App.UserEditRoute = Ember.Route.extend({
  model: function(){ 
    return this.modelFor('user');
  }
});

And the userController.js:

App.UserController = Ember.ObjectController.extend({
  actions: {
    edit: function(){
      this.transitionToRoute('user.edit');
    }
});

Why won't the user.edit.hbs display?


回答1:


I don't know how you configured your router, but a url with /users/<someid>/edit expect this.transitionToRoute('user.edit', someObjectOrId);




回答2:


We can do it in the following way. Kindly check this BIN



来源:https://stackoverflow.com/questions/20326145/edit-template-not-displaying-on-edit-route

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!