I have an EmberJS application using Coffeescript and Ember 2.7.1.
I redirect the /
to /student
.
When I open my application, let's say on http://ift.tt/2bDsywu
(yes, I need the ~somebody/dist
part), it goes to http://ift.tt/2bI1RDT
as expected.
I also have other pages, for example /settings
. When I manually change the url from http://ift.tt/2bI1RDT
to http://ift.tt/2bDsnRE
, it doesn't load the page.
I get a Failed to load resource: the server responded with a status of 404 (Not Found) error.
The Settings router is "empty" (I didn't touch it) and the Student router returns now a hard coded json-like data as model. Both of them will fetch data from a server via Ember Data.
Any idea how to fix this?
My router.coffee file:
`import Ember from 'ember'`
`import config from './config/environment'`
Router = Ember.Router.extend
location: config.locationType,
rootURL: config.rootURL
Router.map ->
@route 'student'
@route 'settings'
@route 'statistics'
@route 'directory'
`export default Router`
My routes/index.coffee file:
`import Ember from 'ember'`
IndexRoute = Ember.Route.extend
beforeModel: ->
@transitionTo('student')
`export default IndexRoute`
My environment.js file:
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'something-frontend',
environment: environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
ENV.location = 'hash';
ENV.rootURL = '/~somebody/dist'
}
return ENV;
};
Aucun commentaire:
Enregistrer un commentaire