var commonsApp = angular.module("commonsApp", []).config(['$sceDelegateProvider', function($sceDelegateProvider) { var whitelistedDomains = ['self']; try { for (var key in imageCDNMap){ if (imageCDNMap.hasOwnProperty(key)) { whitelistedDomains.push(imageCDNMap[key] + '**'); } } } catch (e) { console.log(e); } $sceDelegateProvider.resourceUrlWhitelist(whitelistedDomains); }]); Array.prototype.count = function() { var counter = 0; // Initializing main counter for (i in this) // Looping through elements if (typeof this[i] != "undefined") // If // empty // it's // undefined counter++; // Counting not empty // elements return counter - 1; // Excepting own function }; commonsApp.controller('interstitialPopupController', ['$scope','$http','Constants', function($scope,$http,Constants) { var source = getUrlParameter('reg_src'); var baseUrl = Constants.apiUrl; $scope.close = function(){ $scope.type=undefined; } if(source == 'OBS-2'){ var promise = $http.get(baseUrl + "/obs/welcome-msg-details.htm"); promise.then(function(result){ if(result.data){ $scope.name = result.data.name; $scope.count = result.data.count; if($scope.name && $scope.count){ $scope.msgType = "employer"; $scope.type = "OBS"; return; } } $scope.msgType = "generic"; $scope.type = "OBS"; },function(err){ $scope.msgType = "generic"; $scope.type = "OBS"; }) } }]);