Hi i have to disable button if i get scenariosViewAll.collectionBookObject ={} array ,For this i am using function to return below is my code:
<button" ng-disabled="scenariosViewAll.isSetDisable(scenariosViewAll.collectionBookObject)">Create Book from Collection</button>
and in controller my code is:
function isSetDisable(obj) {
return typeof(obj === 'Object') && Object.keys(obj).length === 0 ? true : false;
}
getting console error as below and it is working properly, any wrong in my code.
lib.min.js:3762 TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at scenariosViewAllController.isSetDisable (app.min.js:29729)
at fn (eval at compile (lib.min.js:3876), <anonymous>:4:415)
at m.$digest (lib.min.js:3787)
at m.$apply (lib.min.js:3790)
at lib.min.js:3803
at e (lib.min.js:3690)
at lib.min.js:3693
typeof(obj === 'Object')will always return"boolean"which is truthytypeofoperator