Skip to content

Instantly share code, notes, and snippets.

@kutsaniuk
Created October 20, 2017 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kutsaniuk/fc324525c5ce226135a8c17b92cb8655 to your computer and use it in GitHub Desktop.
Save kutsaniuk/fc324525c5ce226135a8c17b92cb8655 to your computer and use it in GitHub Desktop.
(function () {
'use strict';
angular
.module('main')
.controller('SpeakersCtrl', SpeakersCtrl);
function SpeakersCtrl($rootScope, SpeakersService, Notification, $log, MEDIA_URL, $state) {
var vm = this;
init();
vm.removeSpeaker = removeSpeaker;
function init() {
getSpeakers();
}
function getSpeakers() {
function success(response) {
vm.speakers = response.data.objects;
}
function error(response) {
$log.error(response.data);
}
SpeakersService
.getSpeakers()
.then(success, error);
}
function removeSpeaker(slug) {
function success() {
getSpeakers();
Notification.primary('Removed!');
}
function error(response) {
$log.error(response.data);
}
SpeakersService
.removeSpeaker(slug)
.then(success, error);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment