I see in Angular2 Dart Angular for Dart Cheat Sheet (v2.0.0-beta.2) that the Elvis operator is supported.
I am trying to use it in an a components view but it seems that it is not allowed here.
Given
.html
<div
<label
for = "first">First<span class = "require">*</span></label>
<input
type = "text"
[(ngModel)] = "name?.first"
id = "first">
.dart
...
Name name = new Name();
...
Running the application gives the following error:
error trace
Transform TemplateCompiler on
epimss_ng2_reg|lib/components/name_component.ng_meta.json threw error: Template parse errors:
Parser Error: The '?.' operator cannot be used in the assignment at column 13 in [name?.first=$event] in NameComponent@39:12 ("
<input
type = "text"
[ERROR ->][(ngModel)] = "name?.first"
#firstCtrl = "ngForm"
[ngFormControl] = "nameForm"): NameComponent@39:12
What circumstance can I use the operator in a component's view?
Cheers
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…