I need to show a message of "No categories" so im using this:
<div ng-repeat="categoryItem in categories">
<div ng-show="categoryItem.length">No categories</div>
And doesn't work.
It's an array of objects, so in the console if i have 2 categories i can see this:
Array[2]
0
:
Object
$$hashKey
:
"object:77"
created_at
:
"2016-12-07T19:45:29.997063"
created_by
:
"test"
id
:
39
name
:
"Category 1"
updated_at
:
"2016-12-07T19:45:29.997105"
updated_by
:
null
__proto__
:
Object
1
:
Object
$$hashKey
:
"object:78"
created_at
:
"2016-12-07T19:45:34.202915"
created_by
:
"test"
id
:
40
name
:
"Category 2"
updated_at
:
"2016-12-07T19:45:34.202947"
updated_by
:
null
__proto__
:
Object
length
:
2
So, when i delete all the categories i programmed a simple if:
if($scope.categories.length === 0){
console.log("No categories");
}
It works but the message are not showed in the view, what im doing wrong?