- Learn
- Tutorial
- FAQ
- Videos
- Free Course
- Case Studies
- Develop
- Developer Guide
- API Reference
- Error Reference
- Contribute
- Seed App project template
- GitHub
- Changelog
- Download
- Discuss
- Blog
- Google+
- Feature & Bug Tracker
- Mailing List
- IRC
- Gitter
Angular7- Sort in Alphabetical Order- Select Dropdown options
1 year ago
I have a list of commodity items where i have to sort all IDM items in alphabetical order and below that DM items in alphabetical order , rite now my code displays like below order:but i want IDM to display first and next DM
**WRONG:** DM-Air DM-BELL DM-CEL IDM-AIR IDM-BELL IDM-CELL **CORRECT** IDM-AIR IDM-BELL IDM-CELL DM-Air DM-BELL DM-CELmy code is
Source: Angular Questions
Share this:
- Angular7- Sort Select Dropdown options in Alphabetical Order
- October 8, 2020
- In "angular"
- Javascript/Angular 7 Sort *ngFor Options in Alphabetical Order
- October 8, 2020
- In "angular"
- how to display array of object contents alphabetical order starting with small letter to capital in angularjs
- February 7, 2019
- In "javascript"
Categories: angular, javascript, typescript
Tags: angular, javascript, typescript
Leave a Comment
AngularJS orderBy Filter
❮ AngularJS Reference
Example
Display the items alphabetically:
<div ng-app="myApp" ng-controller="orderCtrl">
<ul>
<li ng-repeat="x in cars | orderBy">{{x}}</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('orderCtrl', function($scope) {
$scope.cars = ["Dodge", "Fiat", "Audi", "Volvo", "BMW", "Ford"];
});
</script>
Try it Yourself »
<ul>
<li ng-repeat="x in cars | orderBy">{{x}}</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('orderCtrl', function($scope) {
$scope.cars = ["Dodge", "Fiat", "Audi", "Volvo", "BMW", "Ford"];
});
</script>
How TO - Sort a List
❮ Previous
Next ❯
Learn how to sort an HTML list, using JavaScript.
Click the button to sort the list alphabetically:
Sort- Oslo
- Stockholm
- Helsinki
- Berlin
- Rome
- Madrid
Try it Yourself »