I just started with AngularJS, So my question might be very basic.
I have a link in one view, which once clicked calls a service, gets the data. In the controller i am changing the view using $location and updating the new view with the data i got from service. The view is changing fine, But i am having issue updating the data. Below is my code.
First View:
<a class="red" ng-href='#RestaurantDetails' ng-click='restaurantDetails()'>
{{restaurant.name}}
</a>
Controller:
$scope.restaurantDetails = function()
{
fpServices.loadRestaurantDetails(function(event){
$scope.restaurantInfo = event;
$scope.restaurantId = event[0].id;
$location.path('/restaurant_details/'+$scope.restaurantId);
});
};
'restaurantInfo' is an object i am getting from service.
Second View:
{{restaurantInfo.name}}
Tried ng-repeat too with no luck. Any help would be greatly appreciated!