Skip to content

Instantly share code, notes, and snippets.

@chrishutchinson
Created November 23, 2017 17:51
Show Gist options
  • Save chrishutchinson/52e6781faec20784f3aadafbf05dedfb to your computer and use it in GitHub Desktop.
Save chrishutchinson/52e6781faec20784f3aadafbf05dedfb to your computer and use it in GitHub Desktop.
// HTML Element
<budget-calculator no-headline></budget-calculator>
// Polymer template code
<template is="dom-if" if="{{showHeadline}}">
<h1>This is my headline</h1>
</template>
// Polymer JavaScript code
properties: {
noHeadline: {
type: Boolean,
value: false,
},
showHeadline: {
type: Boolean,
computed: 'computeShowHeadline(noHeadline)'
}
},
computeShowHeadline: function(noHeadline) {
// Return the opposite of `noHeadline`.
// If `noHeadline` is FALSE, then `showHeadline` will be TRUE
// If `noHeadline` is TRUE, then `showHeadline` will be FALSE
return !noHeadline;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment