In this example we can display array elements using ng-repeat directive and show the buttons infront of first and last array element by assigning "$first" and "$last" value to ng-show directive of two buttons respectively.

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> </head> <body ng-app> <div ng-init="Arrs=[1, 2, 3, 4, 5, 6, 7, 8, 9]"> <div ng-repeat="Arr in Arrs"> {{Arr}} <button ng-show="$first">First</button> <button ng-show="$last">Last</button> </div> </div> </body> </html>