ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Sorting Ordered List element in AngularJS<p>Hi <a class="username" rel="rani">rani</a>,</p> <p>You can use JavaScript Array sort and&nbsp;reverse method.</p> <p>Check this example.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#39;MyApp&#39;, []) app.controller(&#39;MyController&#39;, function ($scope) { $scope.Fruits = [&#39;Mango&#39;, &#39;Apple&#39;, &#39;Banana&#39;, &#39;Orange&#39;, &#39;Guava&#39;]; $scope.SortFruits = function (order) { if (order == &#39;asc&#39;) { $scope.Fruits.sort(); } else if (order == &#39;desc&#39;) { $scope.Fruits.sort(); $scope.Fruits.reverse(); } } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div ng-app=&#34;MyApp&#34; ng-controller=&#34;MyController&#34;&gt; &lt;input type=&#34;button&#34; value=&#34;Ascending Fruits&#34; ng-click=&#34;SortFruits(&#39;asc&#39;)&#34; /&gt; &lt;input type=&#34;button&#34; value=&#34;Descending Fruits&#34; ng-click=&#34;SortFruits(&#39;desc&#39;)&#34; /&gt;&lt;br /&gt; &lt;ol&gt;&lt;li ng-repeat=&#34;fruit in Fruits&#34;&gt;{{fruit}}&lt;/li&gt;&lt;/ol&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/169003/Sorting-Ordered-List-element-in-AngularJS/https://www.aspforums.net:443/Threads/169003/Sorting-Ordered-List-element-in-AngularJS/Thu, 22 Aug 2019 01:41:03 GMT