aboutsummaryrefslogtreecommitdiffstats
path: root/moon_gui/static/app/pdp/edit/pdp.controller.edit.js
blob: 41b73098188bb867e6545aa999346fa283c402b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(function() {

    'use strict';

    angular
        .module('moon')
        .controller('PDPEditController', PDPEditController);

    PDPEditController.$inject = ['$scope', '$rootScope', 'pdp', '$stateParams'];

    function PDPEditController($scope, $rootScope, pdp, $stateParams) {

        var edit = this;

        edit.pdp = pdp;

        edit.editBasic = false;

        activate();

        function activate(){

        }

        /*
         * ---- events
         */
        var rootListeners = {

            'event:pdpUpdatedSuccess': $rootScope.$on('event:pdpUpdatedSuccess', pdpUpdatedSuccess)

        };

        for (var unbind in rootListeners) {
            $scope.$on('$destroy', rootListeners[unbind]);
        }

        /**
         * When the model is updated, this function refresh the current model with the new changes
         * @param event
         * @param pdp
         */
        function pdpUpdatedSuccess(event, pdp){

            edit.pdp = pdp;

        }
    }

})();