samedi 28 février 2015

Ember CLI / resource / wp-api slug

For practice, and because the word 'post' is too confusing these days, I'm creating a resource called thought(s) - I'm getting some wp-json with the WordPress API (so the 'posts' are 'thoughts') - I'm setting the path to /wordpress with the intention of getting urls like this: http:/site.com/wordpress/thought-slug - I'm nesting the resources, so that the path is relative to the parent.


What I don't understand is how I know what the 'dynamic' : part is - and how I choose it. In the tutorials I've found, it's always post_id or something, but the specifics aren't explained.


I have a thoughts.js with {{#link-to 'thought'}}go{{/link-to}}, and a thought.js - and I've done this in the tutorials, so I'm just missing an understanding of how that dynamic part works...


Help :/




router.js



Router.map(function() {

// WordPress
this.resource('thoughts', {
path: '/wordpress' },
function() {
this.resource('thought', {
path: ':thought???'
});
}
);

});

export default Router;




Aucun commentaire:

Enregistrer un commentaire