AngularJS retrieve data via AJAX before Directive runs

后端 未结 3 1466
花落未央
花落未央 2021-02-04 05:32

I\'m using AngularUI\'s uiMap directives to instantiate a google map. The uiMap directive works great with hard-coded data ({mapOptions} and

3条回答
  •  野性不改
    2021-02-04 06:14

    You could just delay execution of ui-map until your data is loaded.

    HTML:

    JS:

    $http.get('/mapdata').then(function(response) {
      $scope.myOpts = response.data;
      $scope.loadingIsDone = true;
    });
    

提交回复
热议问题