I want to try to pass data that was taken from an api:
Javascript:
function RecentCars($scope, $http){
$scope.cars = [];
$http({method:'GET'; url:'/recent'}).success(function(data,status){
$scope.cars = data;
});
$scope.clickThatCar =function(){
// want to pass that cars data to the CarPage Controller
}
}
function CarPage($scope, data){
// get the data for the car that was clicked
}
The HTML:
<div ng-repeat="motor in cars">
<div class="car_row" ng-click="clickThatCar()">
<img class="car_img" src="/images/{{motor._id}}_0.jpg">
<div class="car_info">
<span class="brand_name">{{motor.brand}}</span>
<span class="price">4,200 KD</span>
</div>
</div>
</div>
Im listing some cars using ng-repeat and that bit works fine, however when i click clickThatCar element, I want to just pass the data for the car that was clicked only. Im really new to angular :(