-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-vegetable.html
35 lines (34 loc) · 1.04 KB
/
extract-vegetable.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
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<!--
@demo
-->
<dom-module id="extract-vegetable">
<template>
<style>
:host {
display: block;
}
</style>
<iron-ajax auto url="http://localhost:9000/analyze" method="POST" body="text=[[body]]" content-type="application/x-www-form-urlencoded" on-response="handleResponse" verbose="true"></iron-ajax>
</template>
<script>
Polymer({
is: 'extract-vegetable',
properties: {
body: {
type: String
},
vegetables: {
type: Array,
notify: true
}
},
handleResponse: function(data) {
if (data.detail.response.hasOwnProperty("response")) {
this.set('vegetables', data.detail.response.response.entities);
}
}
});
</script>
</dom-module>