EPG CRUD
[groupbasedpolicy.git] / groupbasedpolicy-ui / module / src / main / resources / gbp / epg / add-epg.controller.js
1 define([
2     'app/gbp/epg/epg.service'
3 ], function () {
4     'use strict';
5
6     angular.module('app.gbp').controller('AddEpgController', AddEpgController);
7
8     AddEpgController.$inject = ['$mdDialog', '$scope', 'EpgService', 'epg'];
9     /* @ngInject */
10     function AddEpgController($mdDialog, $scope, EpgService, epg) {
11         /* properties */
12         $scope.epg = epg ? epg : EpgService.createObject();
13
14         /* methods */
15         $scope.closeDialog = closeDialog;
16         $scope.save = save;
17
18         /* Implementations */
19
20         function closeDialog(){
21             $mdDialog.cancel();
22             $scope.getEpgList();
23         }
24
25         function save() {
26             $scope.epg.put($scope.rootTenant, function(data) {
27                 $scope.closeDialog();
28             }, function(err) {
29             } );
30         }
31     }
32 });