Angular.JS module to handle the Trello Api.
$ bower install angular-trello
var app = angular.module('providertest', ['trello']);
// Configure the Provider
app.config(['TrelloApiProvider', function(TrelloApiProvider) {
TrelloApiProvider.init({
key: 'YOUR_KEY',
secret: 'YOUR_SECRET',
scope: {read: true, write: true, account: true},
name: 'Angular-Trello Test'
});
}]);
// Use into the Controllers
app.controller('TestCtrl', ['$scope', 'TrelloApi', function($scope, TrelloApi){
$scope.boards = [];
$scope.test = function () {
TrelloApi.Authenticate().then(function(){
alert(TrelloApi.Token());
}, function(){
alert('no');
});
};
$scope.getMe = function () {
TrelloApi.Rest('GET', 'members/me').then(function(res){
$scope.boards = res.idBoards;
alert(res);
}, function(err){
alert(err);
});
};
$scope.getBoards = function() {
TrelloApi.boards($scope.boards[0], {}).then(function(res) {
alert(res);
}, function(err) {
alert(err);
});
};
}]);
Gustavo Barrientos Guerrero [email protected]