Closed dam0vm3nt closed 9 years ago
Not sure where def
is coming from but this does bring up a good point. If you override the items name in the model (using an as
attribute) then this item
getter won't work. There are a few options here:
[]
and []=
operators, and delete the item
getter.[]
and []=
operators, and leave the item
getter in place (but it will only work if you don't have an as
attribute)item
getter respect the as
attribute so it always returns the model, and leave everything else as is.[]
and []=
operators, and make the item
getter respect the as
attribute so it always returns the model.My fault, it should be jsElement[jsElement["dataHost"]["as"]]
. And of course it is returning null only when it one uses as
attribute.
That means option 3, right ?
My first instinct is #3
as well but I am a bit afraid it might lead to confusion. For instance in your template you will still be referring to the item by the name you gave for the as
attribute, but then in your code it would always be item
. For that reason option #1
might be better, although it is a breaking change.
That leads me to maybe #4
but adding @deprecated
to the item
getter?
yeah, that seams the best choice, I agree.
fwiw, you can also use the get
method today with whatever name you used for as
ok, thanks for the advice.
new DomRepeatModel.fromEvent(e).item
always returnsnull
.Shouldn't
item
getter be defined asget item => jsElement["def"]
?