-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-trello.js
30 lines (26 loc) · 907 Bytes
/
angular-trello.js
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
'use strict';
angular.module("trello", [])
.factory("trelloService", ['$http', function($http, $q) {
var service = {};
service.loadList = function(id, key) {
return $http.get('https://api.trello.com/1/lists/'+id+'?cards=open&key='+key).then(function(response) {
return response.data;
});
};
return service;
}])
.directive('ngTrelloList', function() {
return {
restrict: 'E',
scope: {
'id': '=trelloId',
'key': '=trelloKey',
},
controller: function($scope, trelloService) {
trelloService.loadList($scope.id, $scope.key).then(function(list) {
$scope.list = list;
});
},
template: '<div class="trello-list"><p class="trello-list-name">{{list.name}}</p><div class="trello-card" ng-repeat="card in list.cards"><p class="trello-card-name">{{card.name}}</p><p class="trello-card-description">{{card.desc}}</p></div></div>'
}
});