Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <reference path="C:\Proyectos\TGYT2015\TGYT2015\TGYT2015Web\Views/Home/defaultView.html" />
- /// <reference path="C:\Proyectos\TGYT2015\TGYT2015\TGYT2015Web\Views/Home/defaultView.html" />
- var homeapp = angular.module('homeapp', ['ngRoute']);
- homeapp.controller('homeController', function ($scope, $http) {
- $scope.searchString = "al";
- $scope.results = null;
- $scope.firstSearch = function () {
- var url = "http://localhost/TGYTApi/api/home2/search/" + $scope.searchString;
- $http({
- method: 'GET',
- url: url
- }).then(function successCallback(response) {
- return response.data;
- }, function errorCallback(response) {
- return null;
- });
- }
- });
- homeapp.config(function ($routeProvider) {
- $routeProvider.
- when('/', {
- templateUrl: '/StaticViews/defaultView.html',
- controller: 'homeController'
- }).
- when('/search', {
- templateUrl: '/StaticViews/firstSearchResults.html',
- controller: 'homeController',
- resolve: {
- results: homeController.firstSearch()
- }
- }).
- when('/entity/:entityId', {
- templateUrl: 'Views/entity.html',
- controller: 'entityController'
- }).
- //when('/search/:phoneId', {
- // templateUrl: 'partials/phone-detail.html',
- // controller: 'PhoneDetailCtrl'
- //}).
- otherwise({
- redirectTo: '/'
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement