Skip to content

Inject the public HarpJS metadata in your root object (window object in the browser).

License

Notifications You must be signed in to change notification settings

ngx-components/old_harp-inject-public-metadata-in-root

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AngularJS Express

Inject public Harp metadata in root

Include this component in your application to inject the public HarpJS metadata in your root object (window object in the browser).

Installation

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.

How to use

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'];

License

MIT.

About

Inject the public HarpJS metadata in your root object (window object in the browser).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published