Created
October 31, 2014 03:38
-
-
Save udarapathmin/a7cdfc156b2942362fb8 to your computer and use it in GitHub Desktop.
designer
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
<link rel="import" href="../core-ajax/core-ajax.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
box-sizing: border-box; | |
} | |
#core_card { | |
position: absolute; | |
width: 390px; | |
height: 120px; | |
border-top-left-radius: 2px; | |
border-top-right-radius: 2px; | |
border-bottom-right-radius: 2px; | |
border-bottom-left-radius: 2px; | |
box-shadow: rgba(0, 0, 0, 0.0980392) 0px 2px 4px, rgba(0, 0, 0, 0.0980392) 0px 0px 3px; | |
left: 280px; | |
top: 110px; | |
background-color: rgb(255, 255, 255); | |
} | |
</style> | |
<core-ajax url="http://tdslanka.com/tns/api/example/items/format/json" handleas="json" auto id="ajax" on-core-response="{{ postsLoaded }}" hidden> | |
</core-ajax> | |
<template repeat="{{post in posts}}"></template> | |
</template> | |
<script> | |
Polymer({ | |
created: function () { | |
this.posts = []; | |
}, | |
postsLoaded: function () { | |
// Make a copy of the loaded data | |
this.posts = this.$.ajax.response.slice(0); | |
}, | |
setFavorite: function (uid, isFavorite) { | |
// no service backend, just log the change | |
console.log('Favorite changed: ' + id + ", now: " + isFavorite); | |
} | |
}); | |
</script> | |
</polymer-element> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment