Bonjour, je débute en angularJS, je fais un appel $get pour récupérer un JSON,
quand j'affiche le JSON a l'aide demais lorsque je fais un
Code : Sélectionner tout - Visualiser dans une fenêtre à part {{jobs}} j'ai bien {"jobs":[{"name":"projettest"},{"name":"test"}]}je ne vois rien.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <tr ng-repeat="job in jobs"> {{job.name}}</tr>
voici mon code complet
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 <html > <head> <script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script> <title>Angular JS Includes</title> </head> <body ng-app =""> <h2>AngularJS Sample Application</h2> <div ng-app ="" ng-controller = "jenkins"> <h4>Jobs</h4> <tr ng-repeat="job in jobs"> {{job.name}} </tr> <h4>Resonse</h4> <p>{{jobs}} </p> </div> <script> function jenkins($scope,$http) { var url = "http://localhost:8080/api/json?tree=jobs[name]"; $http.get(url).success( function(response) { $scope.jobs = response; }); } </script> </body> </html>
Partager