File tree Expand file tree Collapse file tree 6 files changed +17
-1
lines changed Expand file tree Collapse file tree 6 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import { AppComponent } from './app.component';
1111import { REQUEST } from './shared/constants/request' ;
1212import { BrowserTransferStateModule } from '../modules/transfer-state/browser-transfer-state.module' ;
1313
14+ import { BrowserPrebootModule } from 'preboot/browser' ;
15+
1416export function createConfig ( ) : SignalRConfiguration {
1517 const signalRConfig = new SignalRConfiguration ( ) ;
1618
@@ -37,6 +39,7 @@ export function getRequest() {
3739 BrowserModule . withServerTransition ( {
3840 appId : 'my-app-id' // make sure this matches with your Server NgModule
3941 } ) ,
42+ BrowserPrebootModule . replayEvents ( ) ,
4043 BrowserAnimationsModule ,
4144 BrowserTransferStateModule ,
4245
Original file line number Diff line number Diff line change @@ -8,13 +8,16 @@ import { AppComponent } from './app.component';
88import { ServerTransferStateModule } from '../modules/transfer-state/server-transfer-state.module' ;
99import { TransferState } from '../modules/transfer-state/transfer-state' ;
1010
11+ import { ServerPrebootModule } from 'preboot/server' ;
12+
1113@NgModule ( {
1214 bootstrap : [ AppComponent ] ,
1315 imports : [
1416 BrowserModule . withServerTransition ( {
1517 appId : 'my-app-id' // make sure this matches with your Browser NgModule
1618 } ) ,
1719 ServerModule ,
20+ ServerPrebootModule . recordEvents ( { appRoot : 'app' } ) ,
1821 NoopAnimationsModule ,
1922
2023 ServerTransferStateModule ,
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export function ngAspnetCoreEngine(
122122
123123 // Strip out Styles / Meta-tags / Title
124124 const STYLES = [ ] ;
125+ const SCRIPTS = [ ] ;
125126 const META = [ ] ;
126127 const LINKS = [ ] ;
127128 let TITLE = '' ;
@@ -148,6 +149,12 @@ export function ngAspnetCoreEngine(
148149 TITLE = element . children [ 0 ] . data ;
149150 }
150151
152+ if ( element . name === 'script' ) {
153+ SCRIPTS . push (
154+ `<script>${ element . children [ 0 ] . data } </script>`
155+ ) ;
156+ }
157+
151158 // Broken after 4.0 (worked in rc)
152159 // if (element.name === 'style') {
153160 // let styleTag = '<style ';
@@ -188,6 +195,7 @@ export function ngAspnetCoreEngine(
188195 globals : {
189196 styles : STYLES_STRING ,
190197 title : TITLE ,
198+ scripts : SCRIPTS . join ( ' ' ) ,
191199 meta : META . join ( ' ' ) ,
192200 links : LINKS . join ( ' ' )
193201 }
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ public async Task<IActionResult> Index()
5454 ViewData [ "SpaHtml" ] = prerenderResult . Html ; // our <app> from Angular
5555 ViewData [ "Title" ] = prerenderResult . Globals [ "title" ] ; // set our <title> from Angular
5656 ViewData [ "Styles" ] = prerenderResult . Globals [ "styles" ] ; // put styles in the correct place
57+ ViewData [ "Scripts" ] = prerenderResult . Globals [ "scripts" ] ; // scripts (that were in our header)
5758 ViewData [ "Meta" ] = prerenderResult . Globals [ "meta" ] ; // set our <meta> SEO tags
5859 ViewData [ "Links" ] = prerenderResult . Globals [ "links" ] ; // set our <link rel="canonical"> etc SEO tags
5960 ViewData [ "TransferData" ] = prerenderResult . Globals [ "transferData" ] ; // our transfer data set to window.TRANSFER_CACHE = {};
Original file line number Diff line number Diff line change 2828
2929 <!-- Here we're passing down any data to be used by grabbed and parsed by Angular -->
3030 @Html.Raw(ViewData ["TransferData"])
31+ @Html.Raw(ViewData ["Scripts"])
3132
3233 @RenderSection( "scripts", required: false)
3334
Original file line number Diff line number Diff line change 4848 "ng2-signalr" : " 2.0.4" ,
4949 "ngx-bootstrap" : " ^2.0.0-beta.2" ,
5050 "node-sass" : " ^4.5.2" ,
51- "preboot" : " ^4.5.2 " ,
51+ "preboot" : " ^5.0.0 " ,
5252 "raw-loader" : " ^0.5.1" ,
5353 "rimraf" : " ^2.6.1" ,
5454 "rxjs" : " ^5.0.1" ,
You can’t perform that action at this time.
0 commit comments