i have an string array in angularJS and i want to do some kind of sort for it's element i try this code but it isn't work and i don't know why any one has any idea
<div id="cpntainer" data-ng-init="countries = ['Syria','Lebanon','Jordon','Egypt']">
Country Name <br />
<input type="text" data-ng-model="name" /> <br />
<ul>
<li data-ng-repeat="country in countries | filter:name | orderBy:country:false "> {{ country }} </li>
</ul>
</div>
You can use a function in the orderBy-clause like this:
<li data-ng-repeat="country in countries | filter:name | orderBy:'toString()'"> {{ country }}</li>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With