I'm submitting a feature request
Something like
equivalent of
import {App, SomeEnum} from "../app";
<require def="App, SomeEnum" from="../app"/>
<some-element
some-enum-value.bind="SomeEnum.EnumValue1"
>
${App.messagesById[messageId].messageToShow}
</some-element>
etc.
Aurelia seems incomplete unless this is provided.
It can be done already, though not automatically. You would use view engine hooks to declare what should be attached to the override binding context. Then when you imported that module it would make available the items you wanted.
Here's an example:
resources/data/countries.js
import {viewEngineHooks} from 'aurelia-templating';
let countries = [
{ abbreviation: "AF", name: "Afghanistan" },
{ abbreviation: "AL", name: "Albania" },
{ abbreviation: "DZ", name: "Algeria" },
...
];
@viewEngineHooks()
export class CountryBinder {
beforeBind(view) {
view.overrideContext.countries = countries;
}
}
view.html
<template class="user-detail" bindable="controller">
<require from="resources/data/countries"></require>
<select class="form-control">
<option value="" selected="selected">(please select a country)</option>
<option repeat.for="country of countries" value.bind="country.abbreviation">${country.name}</option>
</select>
</template>
async triageQuestion(id) =>{
respondSameDay()
let response = await getResponseFromOP( { timeout : Year} )
if(!response) {
closeQuestion(id,randomReason())
}
}
Most helpful comment
Here's an example:
resources/data/countries.js
view.html