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
Post a Comment