You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example should render Austin twice, once in and again in the call to stache near the bottom. However, only the first instance is rendered. Note if you change the value passed into the template to be an instance of User rather than a POJO, it works as expected.
const User = can.DefineMap.extend({
name: {
type: 'string',
value: 'Austin'
}
})
can.Component.extend({
tag: 'my-component',
view: can.stache(`<p>{{user.name}}</p>`),
ViewModel: can.DefineMap.extend({
user: {
Type: User
}
})
})
const template = can.stache(`
<my-component user:bind="user"></my-component>
<p>{{user.name}}</p>
`)
const frag = template(new can.DefineMap({
user: {} // change this to `new User()` and it works
}))
document.body.appendChild(frag)
The following example should render
Austin
twice, once in and again in the call to stache near the bottom. However, only the first instance is rendered. Note if you change the value passed into the template to be an instance ofUser
rather than a POJO, it works as expected.Working codepen for convenience:
https://codepen.io/anon/pen/eLMvBZ?editors=1111
The text was updated successfully, but these errors were encountered: