0

I call ngDialog in mainController with option controller: 'otherController' and this gives me the ability to use the mainController $scope in otherController, but none of the $scope variables created in otherController are available for the mainController. My question is, how can I access the otherController variables in the mainController?

Marin Takanov
  • 1,079
  • 3
  • 19
  • 36
  • 1
    It sounds like you're trying to get around the point of scope, which is to encapsulate the data of lower-levels of the application. Parent scopes aren't supposed to see stuff in child scopes. They can listen for events or expose an API for exceptional cases. – AlexMA May 14 '15 at 13:15
  • ui-bootstrap's $modal also attach to $rootScope. but personally I abused the Service, and instantiate the service with $scope to get a instance attach to the scope I specified. – YOU May 14 '15 at 13:27

1 Answers1

0

While not the best option, you could put the parts you want to transcend the scope into your root scope, which is accessible from the entire application.

chad_
  • 3,749
  • 2
  • 22
  • 22