-
Notifications
You must be signed in to change notification settings - Fork 519
window not defined #1238
Comments
And also suggest best practice for passing parameters from asp.net to angular. |
In Angular Universal the browser's object 'window' doesn't exist: Here is some info about your question: Hope this helps. |
@GregoryKhakov He also using |
Since |
@SteveSanderson What do you mean I didn't get it. |
If your code relies on the existence of a DI entry called So you need to also declare a value for |
@SteveSandersonMS with out sending any data and If I want make use of window in |
Sorry, I don't think I follow your question! But if you don't want to use the DI technique to have different services for server and client rendering, then you either need to disable server-side rendering altogether, or avoid using |
@SteveSandersonMS I disable server-side rendering for angular 5 for some issues. Now what is best practice of sending data from mvc to angular? |
Generally since the client and server are decoupled, you'd exclusively have your client fetch data from the server using API endpoints called over HTTP. If you're keen to perform some server-side rendering inside the initial HTML page, then you can either write some ASP.NET middleware to intercept those requests and run arbitrary logic to generate the response, or re-enable SSR and put your logic in TypeScript code. Note that your SSR logic does not have to call Angular - you could have a |
Willing to pass my Token from asp.net to angular
Index.cshtml
Coming to app.module.shared.ts
later in the components I'm going to use it as
appConfig.Token
is this scenario I face window not defined.Error
VS 2017 asp.net core 2.0
The text was updated successfully, but these errors were encountered: