M
M
Maxim Ivanov2016-07-12 13:14:43
JavaScript
Maxim Ivanov, 2016-07-12 13:14:43

How to process a template in angular at the time of receiving ajax response?

The html file has labels for displaying information:

<div class="container" ng-controller="MainController">
          <span class="blc" ng-repeat="process in processess">
            <i class="fa fa-space-shuttle"></i>
            <span class="p-left ">{{ process.caption }}</span>
          </span>
</div>


app.controller('MainController', ['$scope', function($scope) { 

/*
если оставить так, то данные выведутся, ибо они уже присутствуют при загрузке страницы
$scope.processess = [
 {caption: "ОПИСАНИЕ_1"},
 {caption: "ОПИСАНИЕ_2"}
];

*/

// однако, данные лежат в базе, и я их вытаскиваю через jquery.ajax + custom
service.processtypes().then(function(data){
// $scope.processess не отрабатывает и не отображается на странице
$scope.processess = [
 {caption: data[0]},
 {caption: data[1]}
];

});

}]);


What to do, tell me how to process ng-repeat correctly when processing ajax?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-07-12
@splincodewd

Read about $digest loop in Angular, use $http instead of jquery,ajax

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question