I am running into an issue setting up routes. I have a route group of
this.route('users', function () {
for
/users
/users/add
as well this.route('users', {path: '/users/:user_id'}, function () {
for routes like
/users/1/edit
/users/1/goals
/users/1/goals/1
The issue I have is that {{#link-to 'users'}}Users{{/link-to}} results in a link to "/users/undefined", which causes other issues, it needs to be "/users". Is there a way to do routes like this or would I be forced to have "users" and "user" route groups?
My routes:
this.route('users', function () {
this.route('add');
});
this.route('users', {path: '/users/:user_id'}, function () {
this.route('edit');
this.route('goals', function(){
this.route('add');
this.route('edit', {path: '/:goal_id/edit'});
});
});
UPDATE: ended up with
this.route('users', function () {
this.route('add');
});
this.route('user', {path: '/user/:user_id'}, function () {
this.route('edit');
this.route('goals', function(){
this.route('add');
this.route('edit', {path: '/:goal_id/edit'});
});
});
Also I needed to fix my branch route js, and learn about this.modelFor('user') to get parent model since params are consumed.