Javascript 如何使用Angular.js和PHP按字母顺序显示列表
我需要一个帮助。我在我的应用程序中使用Angular.js。我有一些列表,内容来自数据库。这里我需要列表顺序应该是字母顺序。我在下面解释我的代码Javascript 如何使用Angular.js和PHP按字母顺序显示列表,javascript,php,angularjs,Javascript,Php,Angularjs,我需要一个帮助。我在我的应用程序中使用Angular.js。我有一些列表,内容来自数据库。这里我需要列表顺序应该是字母顺序。我在下面解释我的代码 <thead> <tr> <th>Sl. No</th> <th> Name</th> <th>User Email</th> <th>Mobile No</th> <th>Login Name</th> &l
<thead>
<tr>
<th>Sl. No</th>
<th> Name</th>
<th>User Email</th>
<th>Mobile No</th>
<th>Login Name</th>
<th>Status</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody id="detailsstockid">
<tr ng-repeat="user in objHodUserData">
<td>{{$index+1}}</td>
<td>{{user.user_name}}</td>
<td>{{user.email}}</td>
<td>{{user.mob_no}}</td>
<td>{{user.login_name}}</td>
<td ng-if="user.user_status==1">Enable</td>
<td ng-if="user.user_status==0">Disable</td>
<td>
<a ui-sref='hod.user'>
<input type='button' class='btn btn-xs btn-green' value='Edit' ng-click="editUserData(user.user_id)" >
</a>
</td>
<td>
<a ui-sref='hod.user'>
<input type='button' class='btn btn-xs btn-red' value='Delete' ng-click="deleteUserData(user.user_id);" >
</a>
</td>
</tr>
</tbody>
序号
名称
用户电子邮件
手机号码
登录名
地位
编辑
删除
{{$index+1}}
{{user.user_name}
{{user.email}
{{user.mob_no}
{{user.login{u name}
使可能
使残废
在这种情况下,我是根据数据库降序添加数据。这里我需要按字母顺序添加数据(例如A、B、C…)。请帮助我解决此问题。您可以使用Angular内置的
orderBy
过滤器:
<tr ng-repeat="user in objHodUserData | orderBy:'user_name' ">
您可以使用Angular的内置
orderBy
过滤器:
<tr ng-repeat="user in objHodUserData | orderBy:'user_name' ">