Created
October 20, 2017 12:10
-
-
Save kutsaniuk/4fa09524e9c7ab97484e0f8cd13f3731 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('AboutCtrl', AboutCtrl); | |
function AboutCtrl($stateParams, AboutService, Notification, $log, MEDIA_URL, $state) { | |
var vm = this; | |
init(); | |
vm.toolbarEditor = [ | |
['h1', 'h2', 'h3', 'h4', 'h5', 'p', 'bold', 'italics', 'underline', 'justifyLeft', 'justifyCenter', 'justifyRight', 'html'] | |
]; | |
vm.save = save; | |
function init() { | |
getPages(); | |
} | |
function getPages() { | |
function success(response) { | |
vm.pages = response.data.objects; | |
} | |
function error(response) { | |
$log.error(response.data); | |
} | |
AboutService | |
.getPages() | |
.then(success, error); | |
} | |
function save(index) { | |
function success() { | |
Notification.primary('Update Page "' + vm.pages[index].title + '" success!'); | |
} | |
function error(response) { | |
$log.error(response.data); | |
} | |
AboutService | |
.updatePages(vm.pages[index]) | |
.then(success, error); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment