I have 2 controllers boxController.js and homeController.js. On box.html page I initialize the boxController.js. Now, I need to use ng-class on box.html page but the variable I need to use inside ng-class is in homeController.js
I have tried service and factories but these return variables that can be shared across multiple controllers. I am somehow confused about using a shared variable inside html, not inside the controller.
**** homeController.js ****
$scope.defaultState = false;
$scope.submitNow = false;
$scope.default = function () {
$scope.defaultState = !$scope.defaultState
}
$scope.defaultToggle = function () {
$scope.submitNow = !$scope.submitNow
}
**** box.html (This page uses boxController.js, not homeController.js) ****
// I need to use $scope.submitNow and $scope.defaultState variables in the ng-class of this div
<div ng-controller="boxController" class="ui" ng-class="{'two.column.grid' : submitNow, 'one.column.grid' : defaultState}">
</div>