Skip to content

Instantly share code, notes, and snippets.

@kutsaniuk
Created October 20, 2017 12:10
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/4fa09524e9c7ab97484e0f8cd13f3731 to your computer and use it in GitHub Desktop.
Save kutsaniuk/4fa09524e9c7ab97484e0f8cd13f3731 to your computer and use it in GitHub Desktop.
(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