core-dropdown with AngularJS

226 views
Skip to first unread message

Uri Goldshtein

unread,
Aug 27, 2014, 7:29:19 AM8/27/14
to polym...@googlegroups.com
I'm trying to recreate the functionality of AngularJS's ui-bootstrap dropdown with core-dropdown.
But I can't find a way to bind an external variable to the current selected item.

For example (i'm doing the Angular binding with [[ ]] instead of {{ }} to show the difference between Polymer ):

<core-dropdown valueattr="programId" selected="[[currentProgramId]]">
      <core-item ng-repeat="program in programs"
                 ng-click="currentProgramId = program._id"
                 programId="[[program._id]]"
                 label="[[program.name]]"></core-item>
</core-dropdown>

When I click an item, it chooses the program.
But when I change the current program id outside of the dropdown, the dropdown selected item doesn't change...

Any help will be greatly appreciated!
Thanks

Yvonne Yip

unread,
Aug 27, 2014, 8:39:56 PM8/27/14
to Uri Goldshtein, polymer-dev
Hmm, the JS version of this code works. Can a Dart peep chime in?


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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/9007c13f-4881-405e-93a7-eab98ebd7795%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Fagnani

unread,
Aug 27, 2014, 9:11:34 PM8/27/14
to Yvonne Yip, Uri Goldshtein, polymer-dev
Uri, are you using angular_node_bind? That's the only way I know of to establish a two-way binding from Angular to a Polymer element.


And it actually uses the [[ ]] syntax you use above.

Let me know if it works.

Cheers,
  Justin






u...@ideapod.com

unread,
Sep 6, 2014, 6:41:37 PM9/6/14
to polym...@googlegroups.com, yky...@google.com, uri.gol...@gmail.com
Thanks guys,
this also looks like a good solution:
Reply all
Reply to author
Forward
0 new messages