Using legacy elements in polymer 2.x

15 views
Skip to first unread message

thomasmu...@yahoo.com

unread,
Sep 24, 2017, 10:54:44 AM9/24/17
to Polymer
Hi, i am wondering how do i use legacy elements in polymer 2.x please?

I am trying to access this.$ but it's returning undefined so i carn't do for example this.$.router.start().

I am trying to update polymer to 2.x here https://gerrit-review.googlesource.com/?polygerrit=0#/c/gerrit/+/128730/ for the gerrit project.

this.$.router.start() is returning undefined in gr-app.js.

Arthur Evans

unread,
Sep 25, 2017, 5:38:42 PM9/25/17
to thomasmu...@yahoo.com, Polymer
Hi,

Yeah, I think the issue you're seeing is because observers can fire before `ready` is called.

You could probably update things to use data bindings instead of, say, adding or removing classes manually. 

But under the circumstances, probably the simplest thing is to check whether `this.$` exists going into the observer method and exit quickly if it doesn't. The call the observer method manually at the end of the `ready` callback. 

Cheers,
Arthur


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 polymer-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/1caaa9d4-87d8-4fa9-9431-b2f0920e1f48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages