mardi 2 mai 2017

ember routes, what does 'this' refer to?

I'm familiar with how this is used in JS.

The example from the ember docs for creating routes is:

 Router.map(function() {
 this.route('about', { path: '/about' });
 this.route('favorites', { path: '/favs' });
 });

Their explanation leaves a bit to be desired:

"When calling map(), you should pass a function that will be invoked with the value this set to an object which you can use to create routes."

What object? A global router object?




Aucun commentaire:

Enregistrer un commentaire