Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. /// <reference path="C:\Proyectos\TGYT2015\TGYT2015\TGYT2015Web\Views/Home/defaultView.html" />
  2. /// <reference path="C:\Proyectos\TGYT2015\TGYT2015\TGYT2015Web\Views/Home/defaultView.html" />
  3. var homeapp = angular.module('homeapp', ['ngRoute']);
  4.  
  5. homeapp.controller('homeController', function ($scope, $http) {
  6. $scope.searchString = "al";
  7. $scope.results = null;
  8.  
  9. $scope.firstSearch = function () {
  10. var url = "http://localhost/TGYTApi/api/home2/search/" + $scope.searchString;
  11. $http({
  12. method: 'GET',
  13. url: url
  14. }).then(function successCallback(response) {
  15. return response.data;
  16. }, function errorCallback(response) {
  17. return null;
  18. });
  19. }
  20. });
  21.  
  22.  
  23. homeapp.config(function ($routeProvider) {
  24. $routeProvider.
  25. when('/', {
  26. templateUrl: '/StaticViews/defaultView.html',
  27. controller: 'homeController'
  28. }).
  29. when('/search', {
  30. templateUrl: '/StaticViews/firstSearchResults.html',
  31. controller: 'homeController',
  32. resolve: {
  33. results: homeController.firstSearch()
  34. }
  35. }).
  36. when('/entity/:entityId', {
  37. templateUrl: 'Views/entity.html',
  38. controller: 'entityController'
  39. }).
  40. //when('/search/:phoneId', {
  41. // templateUrl: 'partials/phone-detail.html',
  42. // controller: 'PhoneDetailCtrl'
  43. //}).
  44. otherwise({
  45. redirectTo: '/'
  46. });
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement