I am new to angular js and I am trying to fix the issue that some of the html code displays before it gets evaluated. It is first showing the expression and then the value. I have added ng-cloak in the body, but it is not working. I, then, tried to add it to the html top section, but no luck. Checked the below link:
ng-cloak not working when page load
but I am not able to find the correct solution for this.
HTML:
<body ng-app="rootApp" ng-cloak>
<div class="pName" ng-init="getDetails()">
<strong> {{desc}} <br>
{{shortdesc}} {{name}}</strong>
</div>
</body>
controller code:
$scope.getDetails = function () {
// this is the service call
service.getName({ id: 3 }).$promise.then(function (data) {
if (data.length > 0) {
$scope.desc = data[0].desc;
$scope.shortdesc = data[0].shortdesc;
$scope.name = data[0].name;
}
});
}