PolymerJS: How to output model data?

Is there a way to output all the model data about polymer elements?

I would like to bring each property and their value to a view.

I know vue does this using

{{ $data | json }} 

But Vue also has a data attribute, which is dumpable. Not sure if it is possible in a polymer to dump all the properties and their value into a view.

I would like to use something similar with polymer. But how?

I know something like this does not work:

 {{ $properties }} 
+7
javascript polymer
source share
1 answer

As far as I know, there are no filters in data bindings in PolymerJS, such as vue.

But you can use the so-called Computed binding :

 <dom-module id="view"> {{dump(model)}} <script> Polymer({ is: 'view', properties: { model: Object }, dump: function(model) { return JSON.stringify(model, null, ' '); } }); </script> </dom-module> 
+8
source share

All Articles