angular: Add "no binding errors" mode
I’m submitting a … [ ] bug report [x] feature request [ ] support request
- Do you want to request a feature or report a bug?
Feature
- What is the current behavior?
App fails to render and crashes when a data-binding fails (e.g, when hero
is null or misspelled in hero.firstName
. There is no way to trap and handle. Doing so at app level loses context. There’s a constant danger of application failure which may not be necessary.
Yes, I could use the elvis operator. But forcing devs to write elvis for thousands of bindings on hundreds of screens is an unfair burden. There is no way to search for missing elvis. It’s a mine waiting for someone to step on it.
Yes I could try to look for these with e2e tests. Good luck with that. Particularly difficult when NgIf
is usually guarding the fort and the true
state is both rare and difficult to produce.
I’m speaking from deep experience. Other platforms are more forgiving (I’m reminded of Silverlight but also Angular 1 and KnockOut, and insert-framework-here.
- What is the expected behavior?
When bindingErrors('ignore')
, Angular short-circuits the binding exactly as it would if I bound to hero
or hero?.firstName
… it presents a blank space.
When bindingErrors('console')
it writes an error to console but does not throw.
bindingErrors('throw)
is the default behavior we know today.
- What is the motivation / use case for changing the behavior?
See above.
- Please tell us about your environment:
All environments Angular version: 2.0.0-beta
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 17 (13 by maintainers)
I like the current default!
Just looking for an escape plan when I’m trapped in Jay Traband’s world … as so many of us are.