-
-
Save ChadKillingsworth/2bf35590c8bc01e22e97811410d4deb2 to your computer and use it in GitHub Desktop.
Polymer Colliding Property// source http://jsbin.com/suwupas
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
<!doctype html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Polymer Colliding Property</title> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.23/webcomponents-lite.min.js"></script> | |
<link href="https://raw.githubusercontent.com/Polymer/polymer/v1.7.1/polymer.html" rel="import"> | |
</head> | |
<body> | |
<colliding-element></colliding-element> | |
<dom-module id="colliding-element"> | |
<template> | |
<ul> | |
<template is="dom-repeat" items="[[list]]" as="colliding"> | |
<li><button on-click="alert">[[colliding]]</button></li> | |
</template> | |
</ul> | |
</template> | |
</dom-module> | |
</body> |
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
Polymer({ | |
is: 'colliding-element', | |
properties: {}, | |
ready() { | |
this.list = [1,2,3,4,5,6,7,8,9]; | |
}, | |
colliding(i) { | |
return this.list[i]; | |
}, | |
alert() { | |
try { | |
// this.colliding has been overwritten by | |
// the as="colliding" attribute on the | |
// dom-repeat | |
alert(this.colliding(0)); | |
} catch (e) { | |
alert(e.message); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment