Here's a fiddle for illustration. When there's an ng-click directive that (for example) calls a function not defined on the controller's $scope (or its parents), it fails silently. When I'm trying to debug a webpage, this behavior is maddening, as a mis-typed function name can mean a lot of wasted time hunting it down. How can I find out when errors are being swallowed like this, and why is the answer "you can't?"
HTML
<div ng-app="AngularApp">
<div ng-controller="FooController">
<button ng-click="noError()"> noError() </button>
<button ng-click="error()"> error() </button>
<button ng-click="works()"> works() </button>
<br/>
<p ng-bind="foo"></p>
</div>
</div>
Javascript
var angularApp = angular.module('AngularApp', []);
angularApp.controller('FooController', ['$scope', function($scope) {
$scope.foo = 0;
$scope.works = function () {
$scope.foo += 1; // no error, everything works
};
$scope.error = function () {
$scope.foo += baz; // ReferenceError: baz is not defined
};
// noError is not defined in the controller, so errors suddenly don't matter?
}]);