It depends on what you want exactly to do but I see two possibilities:
This constant needs to be passed when importing your main module. Whereas it's not possible to do this on the import itself. You can import a function and call it with parameters.
Here is a sample of the main module that bootstraps your application:
import {bootstrap} from '...';
import {provide} from '...';
import {AppComponent} from '...';
export function main(lenderValues) {
bootstrap(AppComponent, [
provide('lenderValues', { useValue: lenderValues })
]);
}
Then you can import it from your HTML main page like this:
<script>
var lenderValues = @Html.Action("GetLenderDropdownValues", "Dropdown");
System.import('app/main').then((module) => {
module.main(lenderValues);
});
</script>
Your lenderValues can be then injected in all elements like a component:
@Component({
(...)
})
export class SomeComponent {
constructor(@Inject('lenderValues') lenderValues) {
}
}
- Define a parameter on
my-rite-ui element
You can specify a parameter at this level but it can't be evaluated. So it's a bit more tedious since you need to serialize it as string with JSON.stringify, gets the element in your component from its corresponding ElementRef and deserialize it using JSON.parse.
Then you can add the data as a provider.