0

Is there a way for ng-view to bind two DOM elements that don't share a common close parent ?

My understanding of ng-view is that it binds a DOM element to dynamically switch between templates (which further generate views). What happens if I have, say, a search bar and a label that have very low "proximity" in the box model sense, but that architecturally should be bound to the same controller ?

Is there a way around this other than forcing same-controller elements to share a common parent and resort to usually bad CSS styling practices ?

1 Answers1

0

You description is very general so I can't give you a specific solution, but you have 2 obvious options here: 1) You can wrap your whole good practiced CSS page in a div that is the ng-view itself. That's not a bad habit actually. Just make the "body" bound to the controller (or wrap your whole page in <div id="wrapper"> and then do with CSS and HTML whatever you like 2) You can use angular-ui which enables multiple views on the same page. https://github.com/angular-ui/ui-router/wiki/Multiple-Named-Views

yccteam
  • 2,168
  • 4
  • 25
  • 47