Working with AngularJS, I have a view controller where I initialize a variable called recipesData. Here is the code for the controller:
(function() {
'use strict';
angular
.module('myApp')
.controller('CookController', CookController);
CookController.$inject = ['$document','$scope','$rootScope','$window'];
function CookController ($document,$scope,$rootScope,$window) {
var vm = this;
var recipesData = load();
var viewer, ui, building;
$scope.load = function () {
var data;
// Create data
// ..........
return data;
};
};
})();
I need to make my recipesData variable global as an external script relies on it being initialized.
<script src="https://myexternal/lib/js/script.js"></script>
How can I make the recipesData variable global or accessible from the script imported in the head of my document? The variable is currently initialized within my controller.
Thank you!