Before I installed my router I set up a global Vue instance and used vue-resource like this:
export const befriend = (recipient, event) => {
Vue.http.post('/route',{
// Data
}).then(function(response) {
// Success
}.bind(this), function(response) {
// Error
});
}
Now my Vue instance is being instantiated by the router itself like this:
router.start(App, 'body');
How can I use vue-resource when I have no variable bound to my instance?
Nevermind I found the answer in the vue-router documentation hidden at the bottom of the page.
In addition:
The root Vue instance will be available as router.app once the initial render is complete.
The router instance will be available in all descendants of the router app as this.$router.
Hope this is of use for someone else who didn't read every bit of the docu mentation.