Binding `undefined` should not change default values
See original GitHub issueWhen binding e.g. aspectRatio to the image cropper, an “undefined” gets treaded as false rather than the default value (true). This is because every settings get set hard in a loop (https://github.com/Mawi137/ngx-image-cropper/blob/9f26c8a1b06e6aa4dcdcd79c3faa519f3e406500/projects/ngx-image-cropper/src/lib/interfaces/cropper.settings.ts#L45).
Would you like (me) to make undefined set the default value and only null set the value? Or does this feel like a breaking change to you? Right now I must repeat your default values in my control reflecting your properties. I cannot use [maintainAspectRatio]="maintainAspectRatio" without setting it to true initially.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Angular Input() takes undefined after providing default value
The default value means when you are not passing any value, then angular puts the default value. But here you are passing undefined...
Read more >Input() default value is not honored #42913 - angular ... - GitHub
Once you pass a value to the input, it should use it as the new value, null and undefined are also considered as...
Read more >this - JavaScript | MDN
It can't be set by assignment during execution, and it may be different each time the function is called. The bind() method can...
Read more >Properties without the default value do not accept undefined
This declaration makes it impossible to bind a variable that has an undefined type. The proper declaration is: TypeScript. @Input() get width(): ...
Read more >Set Default If Null or Undefined Angular - Code Handbook
With Angular 12 version you can use Nullish coalescing operator ?? in templates to set default values if value is null or undefined....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sorry I don’t find the time for it right now - I’ve got it on my backlog 😉
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.