polymer - Using dom-if for conditionals in arrays -


in 0.5 use expressions in dom-if select things in arrays while looping through them. how achieve same effect in 1.0?

it's more efficient use filter/observe feature of dom-repeat instead of nesting dom-if. filter specifies method identifies records display collection, observe tells dom-repeat data observe know when re-run filter. e.g.

<template is="dom-repeat" items="{{records}}" filter="haspersonlabel" observe="item.labels"> ... haspersonlabel: function (labels) {     return (labels.indexof("person") >= 0); } 

documentation here (https://www.polymer-project.org/1.0/docs/devguide/templates.html#filtering-and-sorting-lists).


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -