Angular JS Controller to view binding not updating on window resize

angularjs, angularjs-scope

Solution

The `$scope` only binds to the view on `$digest` cycles - your event doesn't trigger a digest cycle since there was no action taken. You have to call `$scope.$apply()` to trigger a view update.

Be warned tho, `$scope.$apply()` can throw an error if a `$digest` cycle is already in progress.

Problem

Please see the fiddle: http://jsfiddle.net/HB7LU/4089/ On window resize if you check the console, `$scope.showName` keeps getting toggled between true and false as expected. However the view does not update. It remains with the initialized value of true. From my understanding, the `{{}}` or `ng-bind` provides 1 way binding from controller to the view, so the value in the view should update when it changes in the controller. What am I missing?

Original source