I'm trying to solve with route
i've added 2 different controllers for 2 different view
each controller load a different json and this is the problem becouse it
loads the first but when i load the second in the second view it doesn't
work
this is the code how could i fix it??thank you for help
Inserisci qui il codice. 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;
});
})..
Il giorno sabato 16 agosto 2014 16:28:29 UTC+2, roberta sander ha scritto:
>
> Hi i'm using angularjs inside a wordpress plugin it add a jquery tab after
> the article
> in the first tab there is this line echo "<p>".$this->printHTMLNG()."</p>";
> this php function shows an html that load json data from angularjs
> it works and this is the angularjs code
> Inserisci qui il codice...function ArtistsController($scope, $http) {
>
>
> $http.get(
> './wp-content/plugins/WpGeoLocalPost/json/hotelproximity.json').success(
> function(data) {
> $scope.artists = data;
> //$scope.hotels = data.HotelInformationResponse.HotelSummary;
>
> });
>
>
> }
>
> i need that when i click on this link
>
> Inserisci qui il codice...<a href="#" onclick="___it
> should_load_another_json_with_the_artist_id___">{{artist.name}}</a>
>
>
> it should activate another controller that loads json data passing the id
> in the json url
> i don't know how to do that i've bought a book it hasn't arrived yet and
> on the internet i couldn't find something similar could you help me??thank
> you
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.