1

My code looks like this:

        $scope.modal = {};
        $scope.modal.option = {};

Could I combine these into just one statement or do I always have to do this in two stages?

Samantha J T Star
  • 30,952
  • 84
  • 245
  • 427
  • 5
    $scope.modal = {"option" : {}}; – mccainz Feb 03 '14 at 13:15
  • Why didn't you try something very similar to what you've already shown in previous questions, like this: http://stackoverflow.com/questions/21281286/can-i-use-lodash-to-remove-an-element-from-an-array ...or this: http://stackoverflow.com/questions/21278661/can-lodash-test-an-array-to-check-if-an-array-element-has-a-field-with-a-certai ...or this: http://stackoverflow.com/questions/20954718/how-can-i-pass-some-string-containing-index-into-my-directive ...You've obviously declared an object in an object several times already. So what's the issue here? – cookie monster Feb 03 '14 at 13:24

2 Answers2

3

Like this:

$scope.modal = { option: {} };
CD..
  • 72,281
  • 25
  • 154
  • 163
0

$scope.modal = { option : { }, anotherOption : 12 }