PolymerExpressions is enabling named scopes. This is setup for you automatically within Polymer elements. In the main document, you'll need to set it up yourself. Something like:
http://jsfiddle.net/E63ut/ On Tue, Jan 28, 2014 at 3:27 AM, Marcin Warpechowski <[email protected]>wrote: > Sorry, I swapped the links to the "item in items" JSFiddles. Correct links: > > body (does not work): > http://jsfiddle.net/warpech/u59pk/3/<http://www.google.com/url?q=http%3A%2F%2Fjsfiddle.net%2Fwarpech%2Fu59pk%2F3%2F&sa=D&sntz=1&usg=AFQjCNHW06fKIBg91VyfiiAZVA9yjkCTVw> > > > > > Polymer Element (works): > http://jsfiddle.net/warpech/u59pk/6/<http://www.google.com/url?q=http%3A%2F%2Fjsfiddle.net%2Fwarpech%2Fu59pk%2F6%2F&sa=D&sntz=1&usg=AFQjCNEvfrDQQx_J9alE0AOU4wttqAISYg> > > > > > > On Tuesday, January 28, 2014 12:22:30 PM UTC+1, Marcin Warpechowski wrote: >> >> The following syntax: >> >> <template repeat="{{items}}"> >> >> >> works both in Polymer Elements and in the main document body (see how it >> works: http://jsfiddle.net/warpech/u59pk/2/ ) >> >> However, the following syntax ("named scope"): >> >> <template repeat="{{item in items}}"> >> >> >> works only within a Polymer Element template (Polymer Element: >> http://jsfiddle.net/warpech/u59pk/3/ , body: http://jsfiddle.net/warpech/ >> u59pk/6/ ) >> >> I assume this is because the expression "item in items" is only parsed by >> Polymer Expressions, but it took me some time to investigate. >> >> I have few questions: >> 1. Is the "item in items" parsing done by https://github.com/Polymer/ >> polymer-expressions/blob/master/third_party/esprima/esprima.js ? I >> suppose so >> 2. I there a way to make this expression parse outside of a >> <polymer-element>? I see a big benefit from using named scopes in my >> templates but I prefer not to wrap my whole app in a <polymer-element> >> 3. Template Binding page suggests "item in items" would be available in >> <template>, also outside <polymer-element> ( http://www.polymer-project. >> org/platform/template.html ). And I would love it to be so. However, on >> a page where Polymer Expressions ( http://www.polymer-project. >> org/platform/template.html ) are described, it is more clear that it >> only runs within <polymer-element>. Perhaps some clarification should be >> added there. >> >> Thanks for your great work! >> > Follow Polymer on Google+: plus.google.com/107187849809354688692 > --- > You received this message because you are subscribed to the Google Groups > "Polymer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/polymer-dev/bd390c90-93c0-4ae4-b76e-0a1ee69217d9%40googlegroups.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CABMdHiTJBfmc2m3xUViB6TJaSihszi4sLWO8VT2f_7tRo3Areg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
