The following code works as expected and the scope.checked value is reflected in the UI normally
.directive('comparisonSlider',
function () {
return{
restrict: 'E',
templateUrl: '/app/reports/comparison-slider.html',
controller: function ($scope, $rootScope) {
$scope.checked = false;
$rootScope.$on('compare',
function () {
$scope.checked = true;
},
true);
}
}
}
)
but the following code also works, but the changes to scope aren't reflected in the UI.
.directive('comparisonSlider',
function () {
return{
restrict: 'E',
templateUrl: '/app/reports/comparison-slider.html',
controller: function ($scope, $rootScope) {
$scope.checked = false;
$rootScope.$on('compare',
function () {
$scope.checked = !$scope.checked;
},
true);
}
}
}
)
Any ideas?