I'm trying to figure out how I could use one JavaScript object instantiation across multiple controllers in AngularJS. Try to envisage the following scenario:
var objTemplate = new templateObject();
objTemplate.init();
app.controller('HomeController', function($scope) {
objTemplate.slidePage();
});
Obviously the objTemplate.initialise(); doesn't work within the controller and I'm not quite sure how to do it.
EDIT:
Thanks for the answer @Atrix - it looks like the way forward will be to create a new service and move all of the functionality from the JavaScript object to it - then use the service to perform all these operations.