Possibility for a global value convertor
Hello All
In reference to this issue here https://github.com/aurelia/framework/issues/288
We basically want to apply a global value converter to all bindings which will ensure empty strings are always saved into the model as null. This would prevent the need to constantly mark each bind with | NullToEmptyStringValueConverter
Is their any current way to achieve this?
Don't think this one is going to happen in v1 Might be a good Idea for extension point in future.
Let's keep this open for consideration in a future version.
create a file to add 'ValueConverter' for gloabal use
import { FrameworkConfiguration, PLATFORM } from "aurelia-framework";
export function configure(config: FrameworkConfiguration) {
config.globalResources([
PLATFORM.moduleName("##you valueConverter"),
##you can add more valueConverter##
]);
}
add on main.ts or you file with aurelia.use this part:
.feature(PLATFORM.moduleName("<path to the first file>"));
after this you can use the valueConverter global on you project