client/app/home/home_controller.js
author rougeronj
Wed, 08 Apr 2015 00:36:37 +0200
changeset 77 ee963d1c409b
parent 55 10fd23382e76
child 97 0afdaa004ee1
permissions -rw-r--r--
Add new serializer for the data send by Orpheo. We receive XML so we parse it to json. Then we parse some html to get the proper data of each attribute. Add xmlToJson parser module to requirements.txt
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(){
14
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
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
14
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
     5
	angular.module('ammicoHome',['ngRoute'])
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
     6
	.config(function ($routeProvider) {
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
     7
		$routeProvider
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
     8
		.when('/', {
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
     9
			templateUrl: 'home/home.html',
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    10
			controller: 'homeCtrl'
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    11
		});
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    12
	})
54
ccb586464a6f clean js and minor update in html and css
rougeronj
parents: 14
diff changeset
    13
	.controller('homeCtrl', function($scope, $location){
14
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    14
		$scope.searchSubmit = function(){
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    15
			$location.path('/search/' + $scope.q);
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    16
		};
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    17
	})
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    18
	.filter('meta', function() {
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    19
		return function(input, metaName) {
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    20
			var nb = input.length, i = 0, found = false;
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    21
			while(found===false && i<nb){
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    22
				if(input[i].name===metaName){
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    23
					found = true;
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    24
					return input[i].value;
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    25
				}
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    26
				i++;
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    27
			}
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    28
			return '';
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
diff changeset
    29
		};
4d27fbc3f9df Succed to get the books from our api server and print them dynamically
rougeronj
parents: 8
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
})();