client/app/home/home_controller.js
author ymh <ymh.work@gmail.com>
Wed, 08 Jan 2020 17:49:53 +0100
changeset 205 147583c43f0d
parent 97 0afdaa004ee1
permissions -rw-r--r--
add poetry on sync
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
(function(){
97
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
     2
    'use strict';
0
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
97
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
     5
    angular.module('ammicoHome',['ngRoute'])
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
     6
    .config(function ($routeProvider) {
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
     7
        $routeProvider
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
     8
        .when('/', {
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
     9
            templateUrl: 'home/home.html',
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    10
            controller: 'homeCtrl'
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    11
        });
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    12
    })
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    13
    .controller('homeCtrl', function($scope, $location){
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    14
        $scope.searchSubmit = function(){
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    15
            $location.path('/search/' + $scope.q);
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    16
        };
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    17
    })
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    18
    .filter('meta', function() {
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    19
        return function(input, metaName) {
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    20
            var nb = input.length, i = 0, found = false;
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    21
            while(found===false && i<nb){
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    22
                if(input[i].name===metaName){
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    23
                    found = true;
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    24
                    return input[i].value;
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    25
                }
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    26
                i++;
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    27
            }
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    28
            return '';
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    29
        };
0afdaa004ee1 replace all the tab by spaces
rougeronj
parents: 55
diff changeset
    30
    });
0
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
cef349423167 add basic file org + client prototype
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
})();