@@ -12,6 +12,24 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
1212
1313import { NgModule , ApplicationRef } from '@angular/core' ;
1414
15+ import { findNode , getData } from 'nova-helpers' ;
16+
17+ export { load } from 'hypernova' ;
18+
19+ export const loadById = ( name , id ) => {
20+ const node = findNode ( name , id ) ;
21+ const data = getData ( name , id ) ;
22+
23+ if ( node && data ) {
24+ return {
25+ node,
26+ data,
27+ } ;
28+ }
29+
30+ return null ;
31+ } ;
32+
1533const APP_ID = 'hypernova' ;
1634
1735export const HYPERNOVA_DATA = 'Hypernova.Data' ;
@@ -81,6 +99,12 @@ const renderServer = (ServerAppModule, propsData) => {
8199 } ) ;
82100} ;
83101
102+ export const mountComponent = ( Component , Module , node , propsData ) => {
103+ const BrowserAppModule = getBrowserAppModule ( Component , Module , node , propsData ) ;
104+
105+ platformBrowserDynamic ( ) . bootstrapModule ( BrowserAppModule ) ;
106+ } ;
107+
84108export const renderAngular = ( name , Component , Module ) => hypernova ( {
85109 server ( ) {
86110 return async ( propsData ) => {
@@ -98,9 +122,7 @@ export const renderAngular = (name, Component, Module) => hypernova({
98122 payloads . forEach ( ( payload ) => {
99123 const { node, data : propsData } = payload ;
100124
101- const BrowserAppModule = getBrowserAppModule ( Component , Module , node , propsData ) ;
102-
103- platformBrowserDynamic ( ) . bootstrapModule ( BrowserAppModule ) ;
125+ mountComponent ( Component , Module , node , propsData ) ;
104126 } ) ;
105127 }
106128 return Component ;
0 commit comments