ng-universal-demo
ng-universal-demo copied to clipboard
onBootstrap
export function onBootstrap(appRef: ApplicationRef, transferState: TransferState) {
return () => {
appRef.isStable
.filter(stable => stable)
.first()
.subscribe(() => {
transferState.inject();
});
};
}
Is this garanteed?
I have a medium-size angular application and I'm trying to apply the state transfer but my state is being injected before the backend calls...
Anyone had this problem? What can I doing wrong? Thank you!
Not sure, if the data from your backend calls is in the transfer state it should be there by this point. This should be approximately right before the render happens. Note: the TransferState does not automatically pick up your backend data, you must use TransferHttp in place of Http