I would like to have a filter that will check if a given json object is empty, null or undefined. Without using any third-party lib.
function isObjValid(obj) {
return !(obj === undefined || obj === null || Object.keys(obj).length === 0)
};
But when I tried to filter the object from my template :
<ng-if ng-if="$ctrl.data | filter:isObjValid">
...
</ng-if>
I get this error :
Error: [filter:notarray] Expected array but received: {}
Is there any way to avoid notarray ?