Bonjour à tous,

Je suis débutant avec angularJS et j'ai un problème quant à l'appel de la fonction setSkill

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
var app = angular.module('DisplayRequest', ['ngCookies']);
app.controller('ControllerDisplayRequest', function($scope, $http, $window, $cookies){
 
  var ApiKey = $cookies.get('api_key');
  $scope.Error1 = false;
  $scope.Error2 = false;
 
  $scope.setSkill = function (skill) {
    $scope.chosenSkill = skill;
    console.log($scope.chosenSkill);
  };
 
  $http(
    {method: 'GET',
    url: 'http://umannity.com:1337/user',
    headers: {'Authorization': ApiKey }
  }).success(function (data){
    $scope.skills = data.skills;
 
    var parsedSkills = JSON.parse("[\"informatique\",\"enseignement\"]"); //JSON.parse("[\"informatique\",\"enseignement\"]");
    var i = 0;
    var TitleCategories = "";
    while (parsedSkills.length != i) {
      TitleCategories += "<li> <a ng-click='setSkill(\""+ parsedSkills[i] +"\")' class='n b margin' href='#bySkill' data-toggle='tab'> "+ parsedSkills[i] +"</a></li>";
      i++;
    }
    document.getElementById("TitleTabs").innerHTML += TitleCategories;
 
    $http(
      {method: 'GET',
      url: 'http://umannity.com:1337/request',
      headers: {'Authorization': ApiKey }
    }).success(function (data){
      $scope.allhelpdata = data;
    }).error(function (response){
      $scope.Error1 = true;
      console.log("error");
    });
 
 
    $http(
      {method: 'GET',
      url: 'http://umannity.com:1337/request',
      headers: {'Authorization': ApiKey },
      data :{
       "skills": $scope.skills
     } 
   }).success(function (data){
    $scope.skillshelpdata = data;
  }).error(function (response){
    $scope.Error2 = true;
    console.log("error");
  });
 
 
}).error(function (data){
 console.log("Fail get skills");
});
 
 
 
$scope.search = function (item) {
  if ($scope.searchText == undefined)
    return true;
  else {
    if (item.name.toLowerCase().indexOf($scope.searchText.toLowerCase()) != -1 ||
      item.skills.toLowerCase().indexOf($scope.searchText.toLowerCase()) != -1)
      return true;
  }
  return false;
}
 
});

Au niveau du HTML :
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
<div class="tab-pane panel-bord text-padding" id="bySkill">			
    <span id="error" ng-show="Error2">Impossible de charger les demandes d'aides.</span>
    <p ng-repeat="data2 in skillshelpdata | filter:search">
      2<a ng-href="Aide/{{data2.id}}">[Name:]{{data2.name}} [date:]{{data2.date}}		[skills:]{{data2.skills}}</a>
    </p>
</div>
Lorsque je clique sur le lien <a> rien n'apparâit dans le console.