angularjs - How can I defer view rendering until some data is loaded from an external source? -
my app needs load data $rootscope
external source when initializes. since data external source, time required load data not guaranteed. want defer rendering of view until after data loaded successfully. there way achieve this?
note not using angular routing app.
here simplified demo
there isn't clean way prevent view rendering until async operation completes without using route resolves, program custom directive same work.
however, if strictly user experience, using ngshow work swimmingly:
<div ng-show="user.name"> <!-- content won't visible until data set --> </div>
here's updated plunker: http://plnkr.co/edit/mxoqnwhvyp9aoxg0qooc?p=preview
Comments
Post a Comment