Join the Stack Overflow Community
Stack Overflow is a community of 6.2 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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?

share|improve this question

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.