我试图将数据加载到DropDown控件中,但它没有加载请找到下面的代码
Java脚本文件中的代码
var employeeEntries = Employee.query(function () {
$scope.Employeedata = JSON.stringify(employeeEntries);
$scope.Employeedata = employeeEntries;
console.log($scope.Employeedata)
console.log($scope.Employeedata[0].employee_firstname)
});
$scope.setAction = function (action) {
$scope.selectedAction = action;
};
我的HTML文件中的代码
<div class="btn-group" dropdown>
<button type="button" class="btn btn-default" ng-click="submit()">{{Employeedata.employee_firstname}}</button>
<button type="button" class="btn btn-default dropdown-toggle">
<span class="caret"></span>
<span class="sr-only">Split button!</span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="emp in Employeedata track by $index">
<a href="#" ng-click="setAction(action)">{{emp.employee_firstname}} </a>
</li>
</ul>
</div>
我记录后看到的数据是
[{
"id":1,
"employee_firstname":"Prabhakar",
"employee_lastname":"Vijendar",
"created_at":"2016-04-28T12:02:28Z",
"updated_at":"2016-04-28T12:02:28Z",
"employee_contact_number":998046,
"employee_email":"testr@gmail.com",
"employee_designation":"Project Manager",
"employee_address":"Bangalore"
},
{
"id":2,
"employee_firstname":"Sai",
"employee_lastname":"Kumar",
"created_at":"2016-05-05T11:58:30Z",
"updated_at":"2016-05-05T11:58:30Z",
"employee_contact_number":789456123,
"employee_email":"sai.kumar@gmail.com",
"employee_designation":"SSE",
"employee_address":"Velore TN India"
}]