mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-10 23:53:31 -05:00
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
var angular = require('angular');
|
|
|
|
angular.module('ApiCtrl', ['ApiSvc', 'AuthSvc']).controller('ApiController', ['$scope', 'ApiService', 'AuthService', function($scope, ApiService, AuthService) {
|
|
$scope.getKeys = function() {
|
|
ApiService.getAll(function(keys) {
|
|
$scope.keys = keys;
|
|
});
|
|
console.log($scope.keys);
|
|
};
|
|
|
|
$scope.hideNewKey = function() {
|
|
$scope.nModalShow = false;
|
|
};
|
|
$scope.showNewKey = function() {
|
|
$scope.nModalShow = true;
|
|
};
|
|
|
|
$scope.hideKeyInfo = function() {
|
|
$scope.kModalShow = false;
|
|
};
|
|
$scope.showKeyInfo = function(key) {
|
|
$scope.kModalShow = true;
|
|
$scope.currKey = key;
|
|
};
|
|
|
|
$scope.deleteKey = function(key) {
|
|
ApiService.deleteKey(key, function() {
|
|
var index = $scope.keys.indexOf(key);
|
|
console.log('removing index' + index);
|
|
$scope.keys.splice(index, 1);
|
|
$scope.hideKeyInfo();
|
|
$scope.currKey = {};
|
|
});
|
|
};
|
|
}]); |