I have spent much more time than I would like to admit trying to figure this out and I cannot seem to no matter what approach I try. I have a variable being set in a .peb.html file and a corresponding angular module. Like below:
<script type="text/javascript">
var globalVisit = {*visit*};
var cart = {*cart*}
</script>
in the angular module I have two providers defined like below.
buyModule.service('visit', ($window) => {
return $window.visit;
});
buyModule.service('cart', ($window) => {
return $window.cart;
});
and a controller defined like:
buyModule.controller('BuyCtrl', ($window, $scope, visit, cart) => {
$scope.visit = visit;
$scope.cart = cart;
}));
There is much more to the file but it is irrelevant to the question. My problem is that while visit seems to be loading fine via the provider cart appears to be overwritten/loses its value in the controller. I debugged the statement and in the buyModule.service('cart', ($window) => part the $window.cart has a value set but it just disappears when I try to step through the controller. Does anyone know what I am doing wrong here for cart that is working for visit? This has been incredibly frustrating because as far as I can tell they are handled the exact same but have different results. I am using angular 1.x.