Is there a way to update the value of my navbar if it's on navbar controller while performing value manipulation in another controller?
Check out this example I put together to illustrate the issue:
<div ng-app="app">
<div ng-controller="ctrl">
{{number}}
<br><button ng-click="increment()">Increment</button>
</div>
<br>
<br>
<div ng-controller="ctrl2">
{{number || 0}}
</div>
</div>
angular.module("app", [])
.controller("ctrl", ["$scope", function($scope){
$scope.number = 1;
$scope.increment = function(){
$scope.number++;
}
}])
.controller("ctrl2", ["$scope", function($scope){
}]);
How can I change the {{number}} value in the ctrl2 controller?