client/app/search/search_controller.js
author rougeronj
Wed, 11 Mar 2015 17:38:14 +0100
changeset 13 08f34bbc70ee
parent 8 824c87a9084c
child 47 dd750778535c
permissions -rw-r--r--
set up django rest framework

(function(){
  'use strict';

  angular.module('ammicoSearch',['ngResource', 'ngRoute'])
    .config(function ($routeProvider) {
      $routeProvider
        .when('/', {
          templateUrl: 'search/search.html',
          controller: 'searchCtrl'
        });
    })
    .controller('searchCtrl', function($scope, $location, $routeParams, searchApi){
      console.log('search 6',$scope, $location, $routeParams);
      $scope.q = $routeParams.q || '';
      $scope.results = searchApi.searchResource({q:$scope.q, of: 'json', synthesis: 'false', nresults:'50', callback: 'JSON_CALLBACK'}).getJsonp();
    });

})();