Reputation: 7966
In AngularJS I would use:
<pre>{{object|json}}</pre>
Is there a way to do the same thing in PolymerJS?
Upvotes: 4
Views: 1269
Reputation: 3422
The implementation of a custom json
filter is quite simple:
<script>
PolymerExpressions.prototype.json = function(object) {
return JSON.stringify(object);
}
</script>
Then you can use {{object|json}}
anywhere you like.
Upvotes: 5
Reputation: 7552
I don't think so out of the box, you could create a custom element and just render your object as:
JSON.stringify(object)
Upvotes: 2