I have tried various ways but nothing works for me. What I have:
app.controller('someCtrl',
...
$scope.load = function () {
client.loadAgreements().
then(function (response) {
$scope.unapprovedCount = response.data[StatusTypeEnum.Unapproved];
$scope.approvedCount = response.data[StatusTypeEnum.Approved];
$scope.$apply();
});
};
Html part:
<button text="'({{unapprovedCount}})'" ...
<button text="'({{approvedCount}})'"...
When I do:
app.controller('someCtrl',
...
$scope.unapprovedCount = 777;
$scope.load = function () {
client.loadAgreements().
then(function (response) {
$scope.unapprovedCount = response.data[StatusTypeEnum.Unapproved];
$scope.approvedCount = response.data[StatusTypeEnum.Approved];
$scope.$apply();
});
};
I can see 777 when page renders. However I don't see any updates from promise. Variable is assigned but view is not updated. And if I add apply method then I am getting error:
Error: [$rootScope:inprog] $digest already in progress
What else can I try, as I am new to angular and don't know how to do this?
EDIT:
I am not sure if this matters but actually this button uses directive:
<button ng-fas-button-with-color-indicator text"'Approved ({{unapprovedCount}})'" color="red" ...
And text is rendered in some div.
$scope.unapprovedCountis assigned a proper value inthenpart.