Angularjs Check If Promise Is Empty Or Not
Hi I have this code for the purpose of checking if there are users in the database, if it finds shows a list of users on a view, otherwise shows a view with form of user creation,
Solution 1:
It is probably returning an empty array in case nothing is found. Try checking the data length.
if (data.length == 0) {
$location.url('/NewUser')
} else {
$location.url('/UsersList')
}
Post a Comment for "Angularjs Check If Promise Is Empty Or Not"