While attempting to append an array onto an object, I encountered the error message "Cannot set property 'items' of undefined." My goal is outlined below:
$rootScope.jobs.items = [];
$rootScope.jobs.item = {};
$rootScope.jobs.after = 0;
$rootScope.jobs.noOfRecord = 10;
$rootScope.jobs.busy = false;
$rootScope.jobs.finish = false;
In this context, $rootScope
represents a valid object that is AngularJS-compatible and designed for adding objects. There are no reported issues with $rootScope
.
I have reviewed responses on Why I get Cannot set property 'na0' of undefined error?, but concluded that my scenario differs.