Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:13:52+00:00 2026-06-09T16:13:52+00:00

this is a basic ember routing example that doesn’t update the url to /posts

  • 0

this is a basic ember routing example that doesn’t update the url to /posts correct when there is a child route in posts with dynamic segments. all the other routes (including the dynamic segments) correctly update the url. if i take out the dynamic segment child route (called ‘show’, under ‘posts’) then it updates the url correctly. here’s the fiddle code : http://jsfiddle.net/inconduit/NbPpM/3/

and to view fiddle in action where it updates the urls, look here: http://fiddle.jshell.net/inconduit/NbPpM/3/show/#

to summarize – when you click ‘Posts’ the url should update to show /posts , but it does not.

here’s the javascript:

App = Ember.Application.create({
ready: function() {
        App.initialize(App.Router.create({ enableLogging: true }));
    }
});

App.Post = Ember.Object.extend({
    title: null,
    body: null
});

App.posts = [];
App.posts.pushObject(App.Post.create({id:'0', title: "Test post 1", body: "How awesome is Ember.js"}));
App.posts.pushObject(App.Post.create({id:'1', title: "Test post 2", body: "I love working on awesome projects"}));
App.posts.pushObject(App.Post.create({id:'2', title: "Test post 3", body: "I like cats"}));

App.ApplicationController = Ember.ObjectController.extend();
App.ApplicationView = Ember.View.extend({
    templateName: "application_view"
});

App.PostsController = Ember.ArrayController.extend();
App.PostsView = Ember.View.extend({
    templateName: 'posts_view'
});

App.PostController = Ember.ObjectController.extend();
App.PostView = Ember.View.extend({
    templateName: 'post_view'
});

App.AboutController = Ember.ObjectController.extend();
App.AboutView = Ember.View.extend({
    templateName: 'about_view'
});

App.Router = Ember.Router.extend({

    root: Ember.Route.extend({
        goToPostsIndex: Ember.Route.transitionTo('posts.index'),
        goToAbout: Ember.Route.transitionTo('about'),
        goToShowPost: Ember.Route.transitionTo('posts.index.show'),

        index: Ember.Route.extend({
            route: '/',
            redirectsTo: "posts.index"
        }),

        posts: Ember.Route.extend({

            route: '/posts',
            connectOutlets: function (router) {
                    router.get('applicationController').connectOutlet('posts', App.posts);
                },
            index: Ember.Route.extend({
                route: '/',
                connectOutlets: function (router) {
                    router.get('applicationController').connectOutlet('posts', App.posts);
                },
                show: Ember.Route.extend({
                    route: '/:post_id',

                    connectOutlets: function (router, post) {
                        router.get('postsController').connectOutlet('post', post);
                    },
                    deserialize: function(router, params) {

                        var id = params.post_id,
                            i = 0;
                        for (i = 0; i < App.posts.length; i += 1) {
                            if (App.posts[i].id === id) {
                                return App.posts[i];
                            }
                        }
                    },
                    serialize: function(router, context) {
                        var rtnVal = {},
                            id = context.get('id');
                        if (context) {
                            rtnVal = {post_id: id};
                        }

                        return rtnVal;
                    }
                })
            }),
        }),

        about: Ember.Route.extend({
            route: '/about',
            connectOutlets: function (router) {
                router.get('applicationController').connectOutlet('about');
            }
        })
    })
});

​`

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:13:53+00:00Added an answer on June 9, 2026 at 4:13 pm

    Only leaf routes are meant to be navigable (i.e. the reason posts.index wasn’t navigable is that it had a child route).

    http://jsfiddle.net/NbPpM/8/
    I moved posts.index.show to posts.show — the way it is here is a common pattern, at least in my experience.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn this basic thing about processors that should be taught in
Emberjs core has a new router implementation which extends Ember.StateManager. This is the basic
If i was using this basic AJAX jQuery code: $.ajax ({ type: POST, url:
This basic app which was given to me as an project should run quite
I'm reading this basic tutorial on canvas elements . The (almost) in the following
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so
Hi I have this basic random quote script, but I would like it to
I have a js.erb with this basic content: $(#currencies).html(<%= options_for_select([['Dollar', '$']])%>); And the html
Forgive my ignorance in asking this basic question but I've become so used to
Its a interview question. Interviewer asked this basic shell script question when he understand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.