Hi, I have to load a list of holtels from json and then click one hotel to load the hotel details page, i'm trying to solve with route
i've added 2 different controllers for 2 different views
each controller load a different json and this is the problem becouse it loads the first and it works, but when i load the second in the second view it doesn't work it doesn't load anything
this is the code how could i fix it??thank you for help
var module = angular.module("sampleApp", ['ngRoute']);
module.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/route1', {
templateUrl: './ciao1.html',
controller: 'RouteController1'
}).
when('/route2', {
templateUrl: './ciao2.html',
controller: 'RouteController2'
}).
otherwise({
redirectTo: '/route1'
});
}]);
module.controller("RouteController1", function($scope,$http) {
$http.get('./json/hotelproximity.json').success(function(data) {
$scope.artists = data;
});
})
module.controller("RouteController2", function($scope,$http) {
$http.get('./json/hotelinfo.json').success(function(data) {
$scope.hotel =data;
});
})