Created
July 18, 2015 04:42
-
-
Save naderio/f9ce485ec83b76a5fcdb to your computer and use it in GitHub Desktop.
Recreature and reattache custom elements depending on state property' value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dom-module id="test-app"> | |
<style> | |
:host { | |
display: block; | |
} | |
</style> | |
<template> | |
... | |
<template is="dom-if" if="{{isState(state, 'home')}}" restamp="true"> | |
<feed-view count="{{count}}"></feed-view> | |
</template> | |
... | |
</template> | |
</dom-module> | |
<script> | |
Polymer({ | |
is: 'test-app', | |
properties: { | |
state: { | |
type: String, | |
value: 'home' | |
}, | |
count: { | |
type: Number, | |
value: 5 | |
}, | |
}, | |
isState: function(state, value) { | |
return state === value; | |
}, | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment