-
Notifications
You must be signed in to change notification settings - Fork 0
/
bacon-ipsum.html
52 lines (38 loc) · 1.1 KB
/
bacon-ipsum.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<link rel="import" href="../polymer/polymer.html">
<!--
Element providing solution to no problem in particular.
##### Example
<bacon-ipsum></bacon-ipsum>
@element bacon-ipsum
@blurb Element providing solution to no problem in particular.
@status alpha
@homepage http://polymerlabs.github.io/bacon-ipsum
-->
<polymer-element name="bacon-ipsum" attributes="words paragraphs">
<link rel="import" href="../core-ajax/core-ajax.html">
<template>
<link rel="stylesheet" href="bacon-ipsum.css" />
<core-ajax
auto
method="GET"
url="https://baconipsum.com/api/"
params='{"type":"all-meat", "paras":"{{paragraphs}}"}'
handleAs="json"
on-core-response="{{handleResponse}}"></core-ajax>
<p id="thebacon"></p>
</template>
<script>
Polymer({
author: 'Montague Monro',
words: 5,
paragraphs: 2,
theBacon: '',
handleResponse: function (res) {
var scope = this;
res.detail.response.forEach(function (element) {
scope.$.thebacon.innerHTML += (element + "<br><br>");
});
},
});
</script>
</polymer-element>