equivalent to angularjs attribute directive?

135 views
Skip to first unread message

James Campos

unread,
Apr 30, 2014, 5:12:52 PM4/30/14
to polym...@googlegroups.com
is there a polymer equivalent to angularjs attribute directives? i want to define an 'autosave' attribute, which i can add to arbitrary elements, and will automatically save their contents to local storage. is there a way to do this with polymer?

Ian MacLeod

unread,
Apr 30, 2014, 7:42:59 PM4/30/14
to james.r...@gmail.com, polym...@googlegroups.com
Untested, but I suspect you can pull this off by setting up a base element that defines the autosave attribute and behavior - and have all/most of your custom elements inherit from it


On Wed Apr 30 2014 at 2:12:54 PM, James Campos <james.r...@gmail.com> wrote:
is there a polymer equivalent to angularjs attribute directives? i want to define an 'autosave' attribute, which i can add to arbitrary elements, and will automatically save their contents to local storage. is there a way to do this with polymer?

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/f3b35c62-e908-4128-9daa-77ab08bf12c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Fagnani

unread,
Apr 30, 2014, 8:38:58 PM4/30/14
to James Campos, polym...@googlegroups.com

Hi James,

I built something similar to Angular directives for Dart called behaviors. It's based on mutation observers and Element.matches and you could pretty easily port it to JavaScript.

The repo is here https://github.com/justinfagnani/behaviors.dart

An announcement with some details is here: https://plus.google.com/108970026289541541510/posts/EjdR14bA7Dj

Cheers,
  Justin

On Apr 30, 2014 4:12 PM, "James Campos" <james.r...@gmail.com> wrote:
is there a polymer equivalent to angularjs attribute directives? i want to define an 'autosave' attribute, which i can add to arbitrary elements, and will automatically save their contents to local storage. is there a way to do this with polymer?

Follow Polymer on Google+: plus.google.com/107187849809354688692

Günter Zöchbauer

unread,
May 4, 2014, 6:25:22 AM5/4/14
to polym...@googlegroups.com, James Campos
@Justin
This is great!
I'm looking forward trying this out.
Reply all
Reply to author
Forward
0 new messages