Is there a way to output all model data of polymer elements?
I would like to output each property and their value to the view.
I know vue accomplishes this, by using
{{ $data | json }}
But Vue also has a data attribute that is dumpable. Not sure if it is even possible in polymer to dump every property and their value into the view.
I'd like to use something similar with polymer. But how?
I know doing something like this doesn't work:
{{ $properties }}
As far as I know, there is no filters in data bindings in PolymerJS like vue has.
But you can use 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With