What you want is basically a nested views and states. So that all routes under /parent
like /parent/:id
have the same layout. As of now angular ngRoute doesn't support nested ng-views. There are two ways of solving this
- Use the ng-include's and a separate service to handle the routing logic i.e. when to use ng-include to get the layout (header, footer, menu) for this route and of what type.
- Use ui-router which supports nested routing out of the box and will likely be incorporated into the angular-core sooner or later.
Toggling visibility of the elements according to the current route is a fast way to a messed code and a lot of nested conditional statements if you are going to have more than two different layouts.
Hope this example helps JsBin Example. Feel free to ask additional questions regarding the nested views.