Pawan Kr
Pawan Kr

Reputation: 29

Facing issue in angularJs when getting data on bootstrap modal when i set data in $scope

i have set the scope and getting that in console log but on view page modal its showing undefined here is my code :

$scope.showsearchupdate = function($id_protocolo){
var user_path = window.location.pathname;
var arr_path = user_path.split('/');
var search_user = arr_path[2];

$users['get_search_user_update_by_id']($id_protocolo,search_user).then(function(userquestions){
  $scope.userquestions  = userquestions;

  $users['get_search_user_updates'](search_user).then(function(searchuser_updates){
    $scope.searchuser_updates   = searchuser_updates;
  });


$('#search_update').modal('show', {backdrop: 'static'});
console.log($scope.userquestions);
});

}

Upvotes: 0

Views: 33

Answers (1)

pixlboy
pixlboy

Reputation: 1502

Make sure your async call is completed before you open your modal box.

$scope.userquestions = userquestions is being updated inside a promise. You should only call the code for modal box after promise is complete.

Upvotes: 1

Related Questions