mardi 22 décembre 2015

Does not work location history in embedded application: ember js

I have a large application in which want implement a part of the functional on Ember js. There is some page which is located on this path /item/item_id_here/profile/documents Only documents must be Ember app. I create new ember project with ember cli. And include to documents page in my base project vendor.js and ember.js where router is:

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

const Router = Ember.Router.extend({
});

Router.map(function() {
  this.route('test');
});

Router.reopen({
    location: 'history'
});


export default Router;

When I run the application in the console displays an error

UnrecognizedURLError: /item/item_id_here/profile/documents

When i try change:

Router.reopen({
    location: 'hash'
});

Everything works well.

I'm a little worked with Ember so I started to think that my situation is normal. But I decided to double-check and include ember to my basic project directly without ember cli etc. For example:

window.App = Ember.Application.create({
    rootElement: '#ember-app'
});

App.Router.reopen({
    location: 'history'
});


App.Router.map(function() {
    this.route('test');
});

App.IndexRoute = Ember.Route.extend({
    model: function() {
       alert( 'index' ); 
    }
});

App.TestRoute = Ember.Route.extend({
    model: function() {
        alert( 'test' );
    }
});

I was discouraged but everything worked as it should




Aucun commentaire:

Enregistrer un commentaire