Skip to content

Commit

Permalink
Merge branch 'dom-repeat-docs'
Browse files Browse the repository at this point in the history
  • Loading branch information
TimvdLippe committed Feb 2, 2018
2 parents 82cd3da + 5fa059f commit abe4d9a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 48 deletions.
50 changes: 30 additions & 20 deletions lib/elements/array-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -373,40 +373,50 @@
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" id="employeeList" items="{{employees}}">
* <dom-repeat id="employeeList" items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
* </dom-repeat>
*
* <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector>
*
* <div> Selected employees: </div>
* <template is="dom-repeat" items="{{selected}}">
* <dom-repeat items="{{selected}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
* </dom-module>
* ```
*
* ```js
* Polymer({
* is: 'employee-list',
* ready() {
* this.employees = [
* {first: 'Bob', last: 'Smith'},
* {first: 'Sally', last: 'Johnson'},
* ...
* ];
* },
* toggleSelection(e) {
* let item = this.$.employeeList.itemForElement(e.target);
* this.$.selector.select(item);
* }
* });
*class EmployeeList extends Polymer.Element {
* static get is() { return 'employee-list'; }
* static get properties() {
* return {
* employees: {
* value() {
* return [
* {first: 'Bob', last: 'Smith'},
* {first: 'Sally', last: 'Johnson'},
* ...
* ];
* }
* }
* };
* }
* toggleSelection(e) {
* let item = this.$.employeeList.itemForElement(e.target);
* this.$.selector.select(item);
* }
*}
* ```
*
* @polymer
Expand Down
9 changes: 5 additions & 4 deletions lib/elements/dom-repeat.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" items="{{employees}}">
* <dom-repeat items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
Expand Down Expand Up @@ -116,8 +118,7 @@
* Then the `observe` property should be configured as follows:
*
* ```html
* <template is="dom-repeat" items="{{employees}}"
* filter="isEngineer" observe="type manager.type">
* <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type">
* ```
*
* @customElement
Expand Down
50 changes: 30 additions & 20 deletions types/lib/elements/array-selector.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,40 +143,50 @@ declare namespace Polymer {
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" id="employeeList" items="{{employees}}">
* <dom-repeat id="employeeList" items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
* </dom-repeat>
*
* <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector>
*
* <div> Selected employees: </div>
* <template is="dom-repeat" items="{{selected}}">
* <dom-repeat items="{{selected}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
* </dom-module>
* ```
*
* ```js
* Polymer({
* is: 'employee-list',
* ready() {
* this.employees = [
* {first: 'Bob', last: 'Smith'},
* {first: 'Sally', last: 'Johnson'},
* ...
* ];
* },
* toggleSelection(e) {
* let item = this.$.employeeList.itemForElement(e.target);
* this.$.selector.select(item);
* }
* });
* class EmployeeList extends Polymer.Element {
* static get is() { return 'employee-list'; }
* static get properties() {
* return {
* employees: {
* value() {
* return [
* {first: 'Bob', last: 'Smith'},
* {first: 'Sally', last: 'Johnson'},
* ...
* ];
* }
* }
* };
* }
* toggleSelection(e) {
* let item = this.$.employeeList.itemForElement(e.target);
* this.$.selector.select(item);
* }
* }
* ```
*/
class ArraySelector extends
Expand Down
9 changes: 5 additions & 4 deletions types/lib/elements/dom-repeat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ declare namespace Polymer {
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" items="{{employees}}">
* <dom-repeat items="{{employees}}">
* <template>
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
* </template>
* </dom-repeat>
*
* </template>
*
Expand Down Expand Up @@ -105,8 +107,7 @@ declare namespace Polymer {
* Then the `observe` property should be configured as follows:
*
* ```html
* <template is="dom-repeat" items="{{employees}}"
* filter="isEngineer" observe="type manager.type">
* <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type">
* ```
*/
class DomRepeat extends
Expand Down

0 comments on commit abe4d9a

Please sign in to comment.