I am using ng-bind-html
for binding data that I get from database.
app.controller(\'customersC
So here's what is happening:
$scope.myHTML
valueeach()
loopNotice that the digest cycle runs after your jQuery each()
loop -- or, more specifically, after your $http
callback function is finished running.
That means the value of $scope.myHTML
in your controller is not applied to the ng-bind-html
directive until after your loop has already finished.
To overcome this, you could use Angular's $timeout service instead of the native browser setTimeout()
method. By default, $timeout
will invoke the callback function during the next digest cycle, which means it will run after the changes to $scope.myHTML
are applied to the ng-bind-html
directive (as long as you update $scope.myHTML
before calling $timeout()
).
Working example: JSFiddle