Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 1.2 KB

angular.md

File metadata and controls

50 lines (41 loc) · 1.2 KB

Include the chronosjs js file in your main html.

<script type="text/javascript" src="/node_modules/dist/PostMessageCourier.js"></script>

Channels is already provided with the ngChronos module, you can use it by adding:

<script type="text/javascript" src="/node_modules/wrappers/ngChronos.js"></script>

And skip to adding Chronos dependency to your app

Create a module and add a factory to it with the following code:

var module = angular.module('Chronos', []);

Channels

module.factory('Chronos.Channels', function ($window) {
    var channels = new $window.Chronos.Channels();

    return channels;
});

PostMessageCourier

module.factory('Chronos.PostMessageCourier', function ($window) {
    var postMessageCourier = new $window.Chronos.PostMessageCourier({
        //YOUR configuration here
    });

    return postMessageCourier;
});

In you app.js add the Chronos dependency:

angular.module('myApp', [
    'Chronos',
])

In your controller:

module.controller('Chronos.Channels', 'Chronos.PostMessageCourier', function (channels, postMessageCourier) {
    //Your controller
});