I searched the web for a way to create and output a JSON-LD object using AngularJS, but with no luck.
What I'm trying to achieve is to add structured data to my SPA, as described for the events here:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Event",
"name": "Example Band goes to San Francisco",
"startDate" : "2013-09-14T21:30",
"url" : "http://example.com/tourdates.html",
"location" : {
"@type" : "Place",
"sameAs" : "http://www.hi-dive.com",
"name" : "The Hi-Dive",
"address" : "7 S. Broadway, Denver, CO 80209"
}
}
</script>
https://developers.google.com/structured-data/rich-snippets/events
The easiest way to do this is to create a JSON-LD object and output it to a script tag. But, as far as I know, it is impossible / good practice to access the values of the area inside the script tag as follows:
<script type="application/ld+json">
{{jsonLdObject}}
</script>
Can someone help me with a better approach to this, and is it good to create a JSON-LD object as a regular JSON object?