angular_analyzer_plugin icon indicating copy to clipboard operation
angular_analyzer_plugin copied to clipboard

Warn users about values initialized in ngOnInit and bound in template

Open MichaelRFairhurst opened this issue 8 years ago • 2 comments

See here: http://stackoverflow.com/questions/39770978/dart-angular2-null-error-when-rendering-an-object-in-template/39771002#39771002

Would probably be difficult to catch, and maybe belongs in linter, but this would be a nice thing to catch.

MichaelRFairhurst avatar Jan 20 '17 00:01 MichaelRFairhurst

It would also only matter if there is no wrapping element that guards against null like

<div *ngIf="myObject != null">
  <div>{{myObject.myField}}</div>
  <div>{{myObject.myOtherField}}</div>
<div>

which is also a common way to deal with late initialized fields if more than one binding is affected.

zoechi avatar Jan 20 '17 07:01 zoechi

Exactly, the goal would be to suggest those safeguards

MichaelRFairhurst avatar Jan 20 '17 08:01 MichaelRFairhurst