Created
August 4, 2012 00:59
-
-
Save xhh/3253196 to your computer and use it in GitHub Desktop.
ember.js routing problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.App = Ember.Application.create | |
rootElement: '#container' | |
ApplicationController: Ember.ObjectController.extend() | |
ApplicationView: Ember.View.extend | |
templateName: 'application' | |
Router: Ember.Router.extend | |
root: Ember.Route.extend | |
home: Ember.Route.extend | |
route: "/" | |
connectOutlets: (router) -> | |
console.log 'home' | |
course: Ember.Route.extend | |
route: '/course' | |
connectOutlets: (router) -> | |
console.log 'course' | |
$ -> | |
App.initialize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after executing: App.router.transitionTo('course') | |
course | |
home | |
# and the current url is changed from "/" to "/course" | |
# the problem is that, "home" should not be printed here, and the url is changed | |
# incorrectly, it should be "/#/course" | |
# then execute: App.router.transitionTo('home') | |
# nothing happens | |
# then transition to course again: App.router.transitionTo('course') | |
course | |
# and the url is changed from "/course" to "/course#/course" | |
# then transition to home: App.router.transitionTo('home') | |
home | |
# and the url is changed to "/course#" |
mehulkar
commented
Aug 4, 2012
Router: Ember.Router.extend
location: 'hash'
root: Ember.Route.extend
home: Ember.Route.extend
route: "/"
some_action: Ember.Route.transitionTo('root.course')
connectOutlets: (router) ->
console.log 'home'
course: Ember.Route.extend
route: '/course'
connectOutlets: (router) ->
console.log 'course'
It turns out not to be ember's problem, I forgot to remove jquery.history.js in my project. Stupid me...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment