Include this component in your application to inject the public HarpJS metadata in your root object (window object in the browser).
To install the component:
$ ngx install harp-inject-public-metadata-in-root
No clue what the ngx
command line tool is? Learn more about AngularJS Express.
After installing the component, you can include the automatically generated javascript in your application using a script
element:
<script src="/components/harp-inject-public-metadata-in-root/public" type="text/javascript">
Then you can access the public metadata in the browser like this:
console.log(window.__public)
The object has the same structure as the original Harp object so you can access:
console.log(window.__public.component._data)
The data is also available in as an Angular service called harpData
:
function SomeController(harpData){
this.data = harpData.components.example._data;
}
SomeController.$inject = ['harpData'];
MIT.