I am very new with AngularJS and Web Api. I have angular controller that calls my a method in the Web Api. I am trying to bind the data to my DOM but I do not exceed to doing so. The Api only return 1 single object.
Angular Controller:
function adminManageUsersController($scope, $http) {
$scope.data = [];
$http.get("/api/adminapi?Id=2")
.then(function (result) {
//Success
angular.copy(result.data, $scope.data);
//$scope.data = angular.fromJson(result.data);
},
function () {
//Error
}
);
};
HTML:
<div data-ng-controller="adminManageUsersController">
<div class="form-horizontal" ng-model="data">
<div class="form-group">
<label class="control-label col-lg-3 col-md-4">Employee Number</label>
<div class="col-lg-5 col-md-6">
<input type="number" class="form-control" ng-model="EmployeeNumber" />
<div>{{ EmployeeNumber }}</div>
</div>
</div>
</div>
</div>
What am I doing wrong?