client/app/home/home_controller.js
author rougeronj
Wed, 27 May 2015 18:59:55 +0200
changeset 97 0afdaa004ee1
parent 55 10fd23382e76
permissions -rw-r--r--
replace all the tab by spaces

(function(){
    'use strict';


    angular.module('ammicoHome',['ngRoute'])
    .config(function ($routeProvider) {
        $routeProvider
        .when('/', {
            templateUrl: 'home/home.html',
            controller: 'homeCtrl'
        });
    })
    .controller('homeCtrl', function($scope, $location){
        $scope.searchSubmit = function(){
            $location.path('/search/' + $scope.q);
        };
    })
    .filter('meta', function() {
        return function(input, metaName) {
            var nb = input.length, i = 0, found = false;
            while(found===false && i<nb){
                if(input[i].name===metaName){
                    found = true;
                    return input[i].value;
                }
                i++;
            }
            return '';
        };
    });

})();