Ng-Show-Ng-Hide-5

 

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="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></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>
Output