<commit_before>'use strict';

angular.module('app', ['ionic', 'utils'])

.config(function ($stateProvider, $urlRouterProvider, $logProvider) {
    $logProvider.debugEnabled(true); // PUBLISH .debugEnabled(false)

    $stateProvider
        .state('tabs', {
            url: '/tabs',
            abstract: true,
            templateUrl: 'views/tabs.html'
        })
        .state('tabs.decks', {
            url: '/decks',
            views: {
                'decks-tab': {
                    templateUrl: 'views/decks/decks.html',
                    controller: 'DecksController'
                }
            }
        })
        .state('tabs.card', {
            url: '/card',
            views: {
                'card-tab': {
                    templateUrl: 'views/card/card.html',
                    controller: 'CardController'
                }
            }
        })
        .state('tabs.settings', {
            url: '/settings',
            views: {
                'settings-tab': {
                    templateUrl: 'views/settings/settings.html',
                    controller: 'SettingsController'
                }
            }
        })
        .state('tabs.filter', {
            url: '/filter',
            views: {
                'filter-tab': {
                    templateUrl: 'views/filter/filter.html',
                    controller: 'FilterController'
                }
            }
        });
    $urlRouterProvider.otherwise('/tabs/decks');
})

// .state('tabs.deck', {
//     url: '/deck', // XXX /:deckId',
//     views: {
//         'deck-tab': {
//             templateUrl: 'views/deck/deck.html',
//             controller: 'DeckController'
//         }
//     }
// })
// .state('tabs.answer', {
//     url: '/answer',
//     views: {
//         'card-tab': {
//             templateUrl: 'views/answer/answer.html',
//             controller: 'AnswerController'
//         }
//     }
// })
// .state('tabs.about', {
//     url: '/about',
//     views: {
//         'settings-tab': {
//             templateUrl: 'views/about/about.html',
//             controller: 'AboutController'
//         }
//     }
// })
// .state('tabs.help', {
//     url: '/help',
//     views: {
//         'settings-tab': {
//             templateUrl: 'views/help/help.html',
//             controller: 'HelpController'
//         }
//     }
// })
// .state('tabs.reset', {
//     url: '/about',
//     views: {
//         'settings-tab': {
//             templateUrl: 'views/reset/reset.html',
//             controller: 'ResetController'
//         }
//     }
// })
/**
 * Use x name as tag, attribute, class name, or after directive in comment.
 * The associated element is removed.
 */
.directive('x', function () {
    return {
        restrict: 'AE',
        compile: function (el) {
            el.remove();
        }
    };
})

.run(function ($ionicPlatform, $rootScope, $state, $log, getData,
    restoreSettings) {
    getData('config.json', function (config) {
        $rootScope.config = config;
    });

    // https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions\
    // #issue-im-getting-a-blank-screen-and-there-are-no-errors
    // REVIEW $log.log instead of console?
    $rootScope.$on('$stateChangeError', console.log.bind(console));

    $ionicPlatform.ready(function () {
        // Hide the accessory bar by default (remove this to show the
        // accessory bar above the keyboard for form inputs)
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }
        // XXX StatusBar.styleDefault(); // from ionic tabs starter
        // XXX $state.go('tabs.decks', {});
    });

    restoreSettings();
});<commit_msg>fixed getData with tabs state resolve and controller<commit_after>'use strict';

angular.module('app', ['ionic', 'utils'])

.config(function ($stateProvider, $urlRouterProvider, $logProvider) {
    $logProvider.debugEnabled(true); // PUBLISH .debugEnabled(false)

    $stateProvider
    .state('tabs', {
        url: '/tabs',
        abstract: true,
        templateUrl: 'views/tabs.html',
        resolve: {
            configPromise: function ($http) {
                return $http.get('/data/config.json');
            }},
        controller: function ($rootScope, configPromise, $log, $filter) {
            // configPromise is resolved: https://github.com/angular-ui/ui-router/wiki
            $rootScope.config = configPromise.data;
            $log.debug($filter('json')($rootScope.config)); // PUBLISH remove
        }
    })
    .state('tabs.decks', {
        url: '/decks',
        views: {
            'decks-tab': {
                templateUrl: 'views/decks/decks.html',
                controller: 'DecksController'
            }
        }
    })
    .state('tabs.card', {
        url: '/card',
        views: {
            'card-tab': {
                templateUrl: 'views/card/card.html',
                controller: 'CardController'
            }
        }
    })
    .state('tabs.settings', {
        url: '/settings',
        views: {
            'settings-tab': {
                templateUrl: 'views/settings/settings.html',
                controller: 'SettingsController'
            }
        }
    })
    .state('tabs.filter', {
        url: '/filter',
        views: {
            'filter-tab': {
                templateUrl: 'views/filter/filter.html',
                controller: 'FilterController'
            }
        }
    });
    $urlRouterProvider.otherwise('/tabs/decks');
})

// .state('tabs.deck', {
//     url: '/deck', // XXX /:deckId',
//     views: {
//         'deck-tab': {
//             templateUrl: 'views/deck/deck.html',
//             controller: 'DeckController'
//         }
//     }
// })
// .state('tabs.answer', {
//     url: '/answer',
//     views: {
//         'card-tab': {
//             templateUrl: 'views/answer/answer.html',
//             controller: 'AnswerController'
//         }
//     }
// })
// .state('tabs.about', {
//     url: '/about',
//     views: {
//         'settings-tab': {
//             templateUrl: 'views/about/about.html',
//             controller: 'AboutController'
//         }
//     }
// })
// .state('tabs.help', {
//     url: '/help',
//     views: {
//         'settings-tab': {
//             templateUrl: 'views/help/help.html',
//             controller: 'HelpController'
//         }
//     }
// })
// .state('tabs.reset', {
//     url: '/about',
//     views: {
//         'settings-tab': {
//             templateUrl: 'views/reset/reset.html',
//             controller: 'ResetController'
//         }
//     }
// })

/**
 * Use x name as tag, attribute, class name, or after directive in comment.
 * The associated element is removed.
 */
.directive('x', function () {
    return {
        restrict: 'AE',
        compile: function (el) {
            el.remove();
        }
    };
})

.run(function ($ionicPlatform, $rootScope, restoreSettings) {
    // https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions\
    // #issue-im-getting-a-blank-screen-and-there-are-no-errors
    // REVIEW $log.log instead of console?
    $rootScope.$on('$stateChangeError', console.log.bind(console));

    $ionicPlatform.ready(function () {
        // From ionic starter
        // Hide the accessory bar by default (remove this to show the
        // accessory bar above the keyboard for form inputs)
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }
    });

    restoreSettings();
});
{'fraction_non_alphanumeric': 0.1687796132667435, 'fraction_numerical': 0.0, 'mean_word_length': 1.5398373983739837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7339997', 'n_tokens_mistral': 2283, 'n_tokens_neox': 2220, 'n_words': 391}