Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make Angular.js more verbose when things are undefined?

I'm really just getting started in earnest with Angular.js and one of the first things I noticed is that it doesn't often throw errors if something isn't found.

In a trivial example, if something_undefined is undefined:

<p>{{something_undefined}}</p>

this will fail silently with:

<p></p>

In an example with a $resource, if I made a typo like {{member.frist_name}} I'd quite like Angular to tell me that there was no such attribute frist_name on member.

like image 245
tristanm Avatar asked May 27 '13 22:05

tristanm


1 Answers

Just for testing purposes you can display an error message instead of empty string by

<p> {{ something_undefined || 'Not Found !!!' }} </p>
like image 78
emre nevayeshirazi Avatar answered Nov 02 '22 22:11

emre nevayeshirazi