在OSX上更新Xcode的最简单方法是什么?
我在终端看到了这个:
$ brew install xxxxxxx
Warning: Your Xcode (4.3.3) is outdated
Please install Xcode 4.6.
Run Code Online (Sandbox Code Playgroud)
但是当我开放时Xcode > Preferences > Downloads,它说没有更新?
如何使用新的Ember.js路由器以编程方式转换到新路由?
使用旧的Ember.js路由器,您可以使用路由器的send方法以编程方式在路由/状态之间转换:
//OLD Router Syntax
App = Ember.Application.create({
Router: Ember.Router.extend({
root: Ember.Route.extend({
aRoute: Ember.Route.extend({
route: '/',
moveElsewhere: Ember.Route.transitionTo('bRoute')
}),
bRoute: Ember.Route.extend({
route: '/someOtherLocation'
})
})
})
});
App.initialize();
Run Code Online (Sandbox Code Playgroud)
程序转换:
App.get('router').send('moveElsewhere');
Run Code Online (Sandbox Code Playgroud)
鉴于新的Ember.js路由器(下面)我们如何完成同样的事情?
//NEW Router Syntax
App.Router.map(function(match) {
match('/').to('aRoute');
match('/someOtherLocation').to('bRoute');
});
Run Code Online (Sandbox Code Playgroud)
这不对,对吧?:
window.location = window.location.href + "#/someOtherLocation";
Run Code Online (Sandbox Code Playgroud)
1)send在App.router实例上调用方法
> App.router.send("moveElseWhere")
TypeError: Cannot call method 'send' of undefined
Run Code Online (Sandbox Code Playgroud)
2)明确声明路线并设置事件
App.ARoute = Ember.Route.extend({
events: {
moveElseWhere: function(context){
this.transitionTo('bRoute');
}
}
);
App.UploadRoute.moveElseWhere()
TypeError: …Run Code Online (Sandbox Code Playgroud)