Created
October 20, 2017 12:11
-
-
Save kutsaniuk/fc324525c5ce226135a8c17b92cb8655 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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