2017-01-07 112 views
0

工作,我就是用這個灰燼路由文件映射此URI www.example.com/home/page與位於主文件夾灰燼JS路由選擇不在2.10

export default { 
    resource: 'home', 
    path: '/home', 
    map() { 
     this.route('main-page', { path: 'page' }); 

    } 
}; 

模板主page.hbs我工作的很好,直到我將我的應用程序從1.2.0升級到2.1.0。在文檔中,我沒有發現兩個版本在路由方面的差異。路由文檔中是否有任何更改?難道我做錯了什麼?我是一個新手在灰燼JS和創始難以理解路由文檔

該插件完整的源代碼是可用@github 和我使用的discourse應用

+2

你展示該文件是一個特定的語篇的事情。這不是在簡單的Ember應用程序中進行路由的方式,這可能是Ember文檔對您沒有幫助的原因。 – Ed4

回答

0

這是當前語法的示例的router.js

我不確定你的的具體情況,但希望這會有所幫助。

import Ember from 'ember'; 
import config from './config/environment'; 

const Router = Ember.Router.extend({ 
    location: config.locationType, 
    rootURL: config.rootURL 
}); 

Router.map(function() { 
    // note the implicit 'application' route with {{outlet}} 
    this.route('main-page', { path: '/home'); // or '/' to make it the root 
    this.route('rainbow', function() { 
    this.route('red'); 
    this.route('orange'); 
    // ... nested 
    this.route('vampire'); 
}); 

export default Router; 

https://guides.emberjs.com/v2.1.0/routing/defining-your-routes/