Created
July 15, 2015 15:05
-
-
Save cosmicdreams/52371b522bef99b1a51c to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- 1. Load platform.js for polyfill support. --> | |
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> | |
<!-- 2. Use an HTML Import to bring in the element. --> | |
<link rel="import" href="bower_components/iron-ajax/iron-ajax.html"> | |
</head> | |
<body> | |
<!-- 3. Declare the element. Configure using its attributes. --> | |
<dom-module id="drupal-usercard"> | |
<style></style> | |
<template> | |
<iron-ajax | |
auto | |
url="https://www.drupal.org/api-d7/user/42579.json" | |
handle-as="json" | |
on-response="handleResponse" | |
debounce-duration="300"></iron-ajax> | |
<template> | |
{{userjson.uid}} | |
</template> | |
</template> | |
<script> | |
// Wait for 'polymer-ready'. Ensures the element is upgraded. | |
console.log("In Script"); | |
Polymer({ | |
is: 'drupal-usercard', | |
properties: { | |
userjson: Object | |
}, | |
uid: "test", | |
handleResponse: function(event){ | |
console.log("In Response"); | |
console.log(event.detail.response); | |
this.userjson = event.detail.response; | |
} | |
}); | |
</script> | |
</dom-module> | |
<!-- 4. Use the element --> | |
<drupal-usercard></drupal-usercard> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment