if(!localStorage.getItem('initData') || JSON.parse(localStorage.getItem('initData')).length === 0){ $window.localStorage.setItem('initData', JSON.stringify($scope.initData)); }