You could potentially create a filter that checks for the property being undefined:
app.filter("throwUndefined", function ($exceptionHandler) {
return function (input) {
if (input === undefined) {
$exceptionHandler(new Error("Property was undefined"),
"throwUndefined filter");
}
return input;
};
});
Seems a bit of overhead but with HTML like this:
<div ng-app="myApp" ng-controller="myController">
{{variable | throwUndefined}}
{{variable1 | throwUndefined}}
</div>
The undefined variables will call the exception handler. There is not a way to see the property that triggered this or to see if it was because the property isn't defined or was set to the value undefined, but you could plumb the call stack to find it. It seems you want more trust between your view and the controller, though - i.e. I'd say have your controller check but if you do that you can always ensure a value is set.