all files / components/coupons/ coupons.controller.js

11.11% Statements 1/9
0% Branches 0/5
0% Functions 0/2
11.11% Lines 1/9
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                                                      
angular.module('webmapp')
 
.controller('CouponController', function CouponController(
    $location,
    $rootScope,
    MapService,
    Model,
    Utils,
    CONFIG
) {
    var vm = {},
        featureMapById = vm.featureMapById = MapService.getFeatureIdMap();
    
    vm.coupons = MapService.getCouponsList();
 
    vm.openCoupon = function(coupon) {
        var poiToOpen;
 
        if (coupon && 
            typeof coupon.pois === 'object' && 
            typeof featureMapById[coupon.pois[0]] !== 'undefined') {
            poiToOpen = featureMapById[coupon.pois[0]];
            Utils.goTo('layer/' + poiToOpen.parent.label.replace(/ /g, '_') + '/' + poiToOpen.properties.id);
        }
    };
 
    return vm;
});