framework icon indicating copy to clipboard operation
framework copied to clipboard

Possibility for a global value convertor

Open Daniel-Glucksman opened this issue 8 years ago • 3 comments

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?

Daniel-Glucksman avatar Sep 10 '17 10:09 Daniel-Glucksman

Don't think this one is going to happen in v1 Might be a good Idea for extension point in future.

Alexander-Taran avatar Mar 19 '18 14:03 Alexander-Taran

Let's keep this open for consideration in a future version.

EisenbergEffect avatar Mar 19 '18 18:03 EisenbergEffect

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

Squabak avatar Oct 10 '19 08:10 Squabak