Content briefly rendering then disappearing using ng-if

倖福魔咒の 提交于 2019-12-04 09:47:49

This is because the content is rendered untils angular 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 angular "knows" the value of ShowMessgae. Then, at this point, angular 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>

add ng-cloak like below

<div ng-if="ShowMessgae" class="text-danger" ng-cloak>
   <p>
     <strong>
         Message displayed to User
     </strong>
   </p>
 </div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!