Closed timkindberg closed 9 years ago
Temporary workaround is to create a setter for the property that doesn't allow it to be set back to undefined
(which may not be feasible for some use cases). This code will only ever allow data to be undefined
once—at first initialization—after that it can only be set to a non-undefined value:
export default class Child {
set data(val) {
this._data = val !== undefined ? val : this._data;
}
}
Given using angular 1.4.1 and a component such as this:
When I use it in another component, like this:
I end up seeing nothing rendered out in Child. When I look at it in dev tools, I see it set to
undefined
, then{foo: 'bar'}
, then (and here's the problem)undefined
again.What is happening is this:
data
andbind-data
.undefined
, setting Child.data toundefined
{foo: 'bar'}
, setting Child.data toundefined
I think the workaround needs to be that a1atscript disallows usage of both the regular attr (attr) and the bound version of the attr (bind-attr). Obviously both attrs need to be set up, but then when the user uses one, it should somehow cancel out the other somehow. So if I use bind-attr, then attr knows to just stay out of the way.