The prepareInstanceModel closure will be called exactly once for each
instance that a template needs to produce. The return value will be used as
the model parameter to createInstance().

It is also the case that the root model of an element is the element
itself, not a closure. I'm not sure I understand the <template bind="a as
b"> case you describe.


On Fri, Jan 31, 2014 at 1:07 PM, Justin Fagnani <[email protected]>wrote:

> I'm working on some changes to the Dart version of PolymerExpressions and
> I'm trying to better use prepareInstanceModel to build up scope objects.
> I'm finding that prepareInstanceModel isn't being called before the binding
> closure (returned from prepareBinding) in some cases, causing me to have to
> check the type of the incoming model and conditionally wrap it in a Scope.
>
> I was hoping that by using prepareInstanceModel to always return a Scope,
> I could be assured that I always received a Scope in a binding closure. The
> two cases, so far, that I'm seeing the raw model passed to the binding
> closure are a binding on template, like <template bind="a as b"> and with
> custom elements the model is always the element and never a scope.
>
> So is my understanding or prepareInstanceModel incorrect? When is it
> guaranteed to be called?
>
> Thanks,
>   Justin
>
>

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/CABMdHiTyqCDZuFfhgDYxh-2d4_4czp19akGYz%2BQtZkdNGb_iZw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to