Angular 2 (+Dart) inline conditionals: Is the second condition evaluated if the first is false? How to solve? -
this code in component.html (angular dart template):
<div *ngif="selectedoffer!=null && !selectedoffer.isbotenoffer">...</div> this exception get:
exception: nosuchmethoderror: getter 'isbotenoffer' called on null. receiver: null tried calling: isbotenoffer
selectedoffer null sometimes. why second statement evaluated if first false? , how can around best?
angular write generated template file:
_ngif_0_5.ngif = ((ctx.selectedoffer != null) && !ctx.selectedoffer.isbotenoffer);
so shouldn't evaluate selectedoffer.isbotenoffer if selectedoffer null. however, may hitting bug fixed in dart2js: https://github.com/dart-lang/sdk/commit/fe7baee84828e109a49920c2572f3917e5ff8ca5
you might hit issue if setting selectedoffer in component's constructor, doing return in constructor.
Comments
Post a Comment