If an Angular2 template depends on data in order to display, and that data hasn't been loaded yet, it will cause the entire app to break, requiring the user reload his page.
Angular2 resolvers are the solution to this problem. Resolvers prevent pages from loading until their promise or observable resolves. But the problem is that the page won't be rendered at all until the resolver resolves.
What happens if you want to have the page displayed, for example, behind a spinner, and just have the data appear once it's available? Is there a way to do this in Angular2 that still uses resolvers, or is the only way to implement your own service calls in the component, with logic in the template to prevent data from being used if it isn't available? For example, every {{ foo.bar }}
in your templates would have to be changed to {{ foo && foo.bar }}
.
Is there an Angular2-friendly approach to doing this?