I have an Angular 1.x app and I want to initialize some $scope variables:
$scope.listing = {};
$scope.listing.title = 'This is a test';
$scope.listing.description = 'blah';
I also want to initialize an empty object, as follows:
$scope.listing.payment_types._ids = {};
This fails:
angular.js:14328 TypeError: Cannot read property '_ids' of undefined
Seems I must do this:
$scope.listing.payment_types = {};
$scope.listing.payment_types._ids = {};
It seems long-winded, is there a more concise way?