kellykamay

get child attr

Aug 9th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.37 KB | None | 0 0
  1. #html file
  2.  
  3. <dom-module id="year-view">
  4.     <style>
  5.     paper-card {
  6.       margin-bottom: 20px;
  7.       }
  8.     </style>
  9.   <template>
  10.    
  11.     <iron-ajax
  12.    auto
  13.    url="{{url}}"
  14.    handle-as="json"
  15.    last-response="{{response}}">
  16.     </iron-ajax>
  17.    
  18.     <template is="dom-repeat" items="[[response]]">
  19.         <div  class="col-xs-6 col-sm-3">
  20.             <paper-card image="[[item.chapters.0.data.thumbnails]]" >
  21.                 <month-name the-month="[[item.latest_date]]"></month-name>
  22.                 <div class="catebox">
  23.                     <template is="dom-repeat" items="[[item.categories]]">
  24.                         <category-color the-cateid="[[item]]" ></category-color>
  25.                     </template>
  26.                 </div>
  27.             </paper-card>
  28.         </div>
  29.     </template>
  30.  
  31.   </template>
  32.  
  33.   <script src="year-view.js"></script>
  34. </dom-module>
  35.  
  36. #js file
  37. (function() {
  38.   'use strict';
  39.  
  40.   Polymer({
  41.     is: 'year-view',
  42.     listeners: {
  43.         'tap': 'regularTap'
  44.     },
  45.     properties:{
  46.       theYear:{
  47.         reflectToAttribute: true,
  48.         type:String
  49.       },
  50.       url:{
  51.         computed: 'computeUrl(theYear)'
  52.       }
  53.  
  54.     },
  55.  
  56.     computeUrl: function(theYear){
  57.       return ['/api/calendar',theYear].join('/');
  58.     },
  59.     regularTap:function(e){
  60.       alert("Hmmmm "+this.theCateid);
  61.     }
  62.  
  63.   });
  64.  
  65. })();
Advertisement
Add Comment
Please, Sign In to add comment