I have a issue when try binding data to template in AngularJS. This is $scope in my controller:
$scope.user = {
ADID: "",
DomainLogonName: "",
}
$scope.viewDetailUser = function (userId) {
var apiUrl = "/api/User/Detail?userId=" + id;
$http.get(getPath).then(
function (success) {
var data = success.data.Data; // always have data here
$scope.user = {
ADID: data.ADID, // always have data here
DomainLogonName: data.DomainLogonName, // always have data here
}
},
function (error) {
alert("Error!");
}
);
I use html template like bellow:
<div class="row">
<div class="col-xs-3">
<label>Domain Logon Name</label>
</div>
<div class="col-xs-3">
<span>{{user.DomainLogonName}}</span>
</div>
<div class="col-xs-3">
<label>ADID</label>
</div>
<div class="col-xs-3">
<span>{{user.ADID}}</span>
</div>
</div>
My app, modules, and controller are correct and i'm not copy to this post. Look seem 2 way binding not working.
<span>{{user.ADID}}</span>
<span class="ng-binding"></span> <= always display blank
I'm try use $apply but not ok. Please help me save my day!