Last active
February 6, 2018 07:55
-
-
Save indzi/2d308c14e339b39b599053b3ffd7ee69 to your computer and use it in GitHub Desktop.
Don’t forget: Polymer camel-cases properties, so if in JavaScript you use myProperty, in HTML you would use my-property.
This file contains hidden or 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
| <some-element hidden$="[[myProperty]]"></some-element> | |
| Attribute binding: when myProperty is true, the element is hidden; when it’s false, the element is visible. The difference between attribute and property binding is that property binding is equivalent to someElement.someProp = value, whereas attribute binding is equivalent to: someElement.setAttribute(someProp, value) |
This file contains hidden or 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
| Computed binding: binding to the class attribute will recompile styles when myProperty changes: | |
| <some-element class$="[[_computeSomething(myProperty)]]"></some-element> | |
| <script> | |
| _computeSomething: function(prop) { | |
| return prop ? 'a-class-name' : 'another-class-name'; | |
| } | |
| </script> |
This file contains hidden or 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
| <some-element their-property="[[myProperty]]"></some-element> |
This file contains hidden or 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
| <some-element their-property="{{myProperty}}"></some-element> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment