Angularjs Get first and last value of list-item (li)

Today, We want to share with you Angularjs Get first and last value of list-item (li).In this post we will show you Angular ngFor, ng-template and the compiler, hear for Add a class to last 3 list items in AngularJS we will give you demo and example for implement.In this post, we will learn about Show only first and last child as result inside `ng-repeat` with an example.

Angularjs Get first and last value of list-item (li)

There are the Following The simple About angularjs show last 5 items in ng-repeat list Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to get last value of array in angularjs, so the Angular NgFor: Everything you need to know is used for this example is following below.

Read Also:  VueJS setTimeout() Function Examples

How to get the last record in an array in AngularJS?

{{ObjectsArr[ObjectsArr.length - 1]}}

var app = angular.module('app', ['ui.bootstrap']);
app.controller('productCtrl', function ($scope) {
	$ = [1,2,3]

<link href="//" rel="stylesheet" type="text/css" />
<script src="//"></script>
  <script src="//"></script>
  <meta charset="utf-8">
<body >
  <div ng-app="app">
    <div ng-controller="productCtrl">
      <li ng-repeat="item in product" ng-if="$last">{{item}}</li>

angularjs show last 5 items in ng-repeat list

using limitTo: -5

<div ng-repeat="product in products | limitTo: -1">

<li ng-repeat="p in product | limitTo:-5 | orderBy:'time':true">...</li>

ng-repeat show only last element

Read Also:  PHP change Laravel Date Formats Example

<div ng-repeat="n in [data[data.length-1]] track by $index">

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about angular 6 get last element of array.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *