A
A
akubenov2018-02-16 12:13:12
Vue.js
akubenov, 2018-02-16 12:13:12

How to load component after http request using vue 2 js?

How to implement component loading after completion of http request .
according to the documentation, I tried beforeRouteEnter, the data is loaded
in parallel in angular 1st, this was implemented when creating the route (resolve)

.state('home.citypointDetail', {
      url: "citypoint/:citypointID",
      templateUrl: static + '/citypoint/details.html',
      controller: 'CitypointDetailController',
      resolve: {
        citypoint: function (CitypointService, $stateParams) {
            var id = $stateParams.citypointID;
            return $http.get('/url/', params: {});
        }
      }
    })

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fomenko_alexandr, 2018-02-16
@fomenko_alexandr

Just add a variable to the data, something like is_loaded: false
And display the required component through v-if="is_loaded"
Accordingly, if the request is successful, change is_loaded: true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question