Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Pass data from .NET code into TypeScript code #1444

@JCPuerto

Description

@JCPuerto

Greetings,

This is related to the Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0-preview1-final angular template.

In the Use the Angular project template page it says : "For example, see how main.server.ts passes the BASE_URL value to any component whose constructor is declared to receive it".

In the recently created file main.server.ts in the extraProviders section there's this { provide: 'BASE_URL', useValue: params.origin + params.baseUrl } line and I thought all I needed to do is create another entry like that one. However, it seems that the BASE_URL provider is actually ignored and is actually taken from the existing main.ts file. I could delete that provider in main.server.ts and nothing happens. If I delete the provider in the main.ts I get a No provider for BASE_URL error.

So could you please show us an example to get a custom value sent from .NET like the one you suggested in the article; data["isHttpsRequest"] = context.Request.IsHttps; ?.

Thank you very much!

Good work by the way. We really appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions