A directive for generating application/json+ld script tag
$ npm install angular-jsonld
Add to your HTML (or build script or whatever). Remember to load it after angular itself.
<script type="text/javascript" src="./node_modules/angular/angular.min.js"></script>
<script type="text/javascript" src="./node_modules/angular-jsonld/angular-jsonld.min.js"></script>
Add to your app's dependency array
angular
.module('my-module', [
'sb-jsonld'
]);
angular
.module('my-module', ['sb-jsonld'])
.controller('MyController', function($scope) {
$scope.myJson = {
"test": "test
}
});
<sb-jsonld json="{{myJson}}"></sb-jsonld>
<script type="application/ld+json">
{
"test": "test"
}
</script>
To build the app, run npm run build
.
MIT Copyright 2016 Sindre Bøyum