In Angular How Do I Automatically select last row in a table and invoke function
html
ng-repeat="order in orders | filter: prop.value |orderBy:orderByField:reverseSort | limitTo:-3" ng-click="selectOrder(order); setSelected()" class={{selected}}
controller
$scope.setSelected = function() {
console.log("show", arguments, this);
if ($scope.lastSelected) {
$scope.lastSelected.selected = '';
}
this.selected = 'selected';
$scope.lastSelected = this;
}
$scope.selectOrder = function (order) {
$scope.selectedOrder = order;
};
This html returns a list of three orders in a list when I click on a row in the list it displays an additional table with the items in an order perfectly
Without clicking on an order no additional table is displayed which is undesirable
Objective: I want it to automatically select and click the last row so additional items in an order is always displayed on screen