Better know a framework #23: Validate binding property name

Sometimes, during development, you would like to validate all bindings of a view to see if there’s any typo. There is a way to do that with View engine hooks. Online demo at: https://codesandbox.io/s/aurelia-binding-name-validator-1isjv

Just need to make sure you don’t include it in your production build, via something similar to below:

if (environment.debug) {
  aurelia.globalResources('path-to-validator')
}
4 Likes

CodeSandbox is currently giving me errors:

Bootstrap error: SyntaxError: fields are not currently supported
1 Like

@bigopon I ended up forking Aurelia TypeScript Sandbox.

I’ve hacked up Validate Bindings as the type of things I’m interested in.

The example logs out warnings when the View uses properties that don’t exist in the ViewModel’s binding context.

1 Like