Source:search-options.component.js

(function () {
    'use strict';
    // Search Options
    angular.module('mohistory').component('searchOptions', {
        templateUrl: 'app/components/search-options/search-options.component.html',
        controller: searchOptionsCtrl,
        controllerAs: 'soptions',
        bindings: {
            data: '<'
        },
    });
    searchOptionsCtrl.$inject = ['$state'];
    /**
     * Displays the search options page, which acts as a gateway to the general,
     * blog, event, and collection searches.
     * @namespace searchOptions
     * @memberof mohistory
     * @name searchOptions
     * @ngdoc component
     * @param {object} $state UI-Router state object
     */
    function searchOptionsCtrl($state) {
        var vm = this;
        /* ----- Variables ----- */
        vm.searchQuery = '';
        /* ----- Function Bindings ----- */
        vm.onFormSubmit = onFormSubmit;
        /* ----- Function Definitions ----- */
        /**
         * Update the UI-Router state to reflect a new keyword search.
         * @function onFormSubmit
         * @memberof searchOptions
         */
        function onFormSubmit() {
            $state.go('main.search', {
                'page': 1,
                'text': vm.searchQuery
            });
        }
    }
})();