What is the best approach: passing the whole object or just the required attribute from view to controller in AngularJS?
For instance:
View
<div ng-repeat="car in parkingLot">
<div ng-click="checkAvailability( car.id )"></div>
</div>
Controller
$scope.checkAvailability = function (id) {
// process id
}
If the controller function only needs the id
of car
and not the entire object, should we pass car.id
for better performance, or send the complete car
object and extract the id
on the controller side?