jeudi 19 mai 2016

Ember. Extend Router for addon

I would like to have common routes defined in my addon, which can be shared by our multiple projects.

I saw a solution in the Ember Forum but I'm not sure if this is the right approach or If I'm doing it rigth.For now I'm getting a type error. http://ift.tt/253x7Uc

addon/utils/route_setup.js:

     export default function(self) {
          self.route('home', {path: ''});
          self.route('thanks');
       });

app/router (dummy app):

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

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

  Router.map(function () {
    coreMap(this);
  });

   export default Router;

Error:

   SyntaxError: modules/ember-gpp/utils/route-setup.js: Unexpected token (4:1)
      self.route('home', {path: ''});
      self.route('thanks');
    });




Aucun commentaire:

Enregistrer un commentaire