Content briefly rendering then disappearing using ng-if
This happens because the content is rendered until AngularJS detects that ShowMessgae
is false
and then hides it.
In order to not show the content at all until angular is ready to "say" whether ShowMessgae
is true
or false
you should use ng-cloak
. This way the content is not shown until AngularJS "knows" the value of ShowMessgae
. Then, at this point, the framework is ready to show (or not) the content, depending on the value of ShowMessgae
<div ng-if="ShowMessgae" class="text-danger" ng-cloak>
<p>
<strong>
Message displayed to User
</strong>
</p>
</div>