feat(AppShell): make shellRender and shellNoRender directives add attributes to host #71
Description
In order for the AppShell parser to properly parse a dynamic page generated by Universal (or other pre-renderer), the app shell directives *shellRender
and *shellNoRender
should add corresponding attributes to the host element: <el shellRender=""></el>
and <el shellNoRender=""></el>
.
Challenges:
Presumably, when pre-rendering on-the-fly with Universal, the isPrerender
provider would be set to false
, which would cause the App Shell directives to behave the same as if the page were being rendered dynamically in the browser. Therefore, any shellRender
components, for example a loading indicator, would not be included in the pre-generated page (since content is already loaded into the page where the loading indicator would otherwise be). There will be an HTML comment placeholder where the component would be: <!-- template bindings={} -->
, but it wouldn't contain enough information to construct the shellRender
element. This could be fixed by changing isPrerender
to something more progressive that could account for:
- building the html app shell page
- pre-rendering a dynamic page (server)
- rendering a dynamic page (browser)
Where case 2 would cause shellRender
to render the loading indicator element so it could be parsed, but not displayed in the page, either by using CSS display: none
or by wrapping the rendered element in HTML comments.
Maybe @mgechev is way ahead of me and has already thought of how to solve this problem :).