%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/news/public/scripts/controllers/roles/
Upload File :
Create Path :
Current File : /var/www/html/news/public/scripts/controllers/roles/role.controller.js

'use strict';

angular.module('controllers').controller('roleController', function ($scope, role, resource, notification) {

    $scope.isNew = !role;

    if ($scope.isNew) {
        $scope.role = {};
    } else {
        $scope.role = role;
    }

    $scope.save = function () {
        if ($scope.isNew) {
            resource.forResource('roles').save($scope.role).then(function (res) {
                notification.success('Role created successfully');
                $scope.back();
            }, function (error) {
                notification.error(error)
            });
        } else {
            resource.forResource('roles').update($scope.role.id, $scope.role).then(function (res) {
                notification.success('Role updated successfully');
                $scope.back();
            }, function (error) {
                notification.error(error)
            });
        }
    };

    $scope.back = function () {
        history.back();
    };

});

Zerion Mini Shell 1.0