Last active
February 28, 2017 08:59
-
-
Save rafagarcia/9f690d42f472bd7f84bc27d0a52e708c to your computer and use it in GitHub Desktop.
Observer example inside list.html
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
| <script> | |
| Polymer({ | |
| is: 'polymaiap-list', | |
| properties: { | |
| data: { | |
| type: Object, | |
| observer: '_handleResponse' | |
| }, | |
| selectedItem: { | |
| type: Object, | |
| observer: '_handleSelection' | |
| } | |
| }, | |
| //Once data is received via ajax and stored in the data property, loader is hidden and employees list is shown | |
| _handleResponse: function() { | |
| this.$.loader.style.display = 'none'; | |
| this.$.listWrapper.style.display = 'block'; | |
| }, | |
| _handleSelection: function() { | |
| if (this.selectedItem) { | |
| this.fire('selectedItem', this.selectedItem); | |
| // Deselect previous selected item to ensure navigation between list and detail | |
| this.$$('iron-list').deselectItem(this.selectedItem); | |
| } | |
| } | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment