1

Is it possible to use multiple view in the same SPA using AngularJS?

I am planning to use 1 view for the header-bar of the page, second one for the body of the page and the third one for the footer of the page. So that the header and footer view don't change every time the location is routed instead only change when depending on the action the user performs on the body, such as click on "Change header" button in the body view etc.

An example would really help.

Thanks.

2 Answers 2

3

You can use ng-include for this:

<div ng-include="'my-header.html'"></div>
<!-- body -->
<div ng-view></div>
<div ng-include="'my-footer.html'"></div>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Also, I found an example for this @ Plunker
1

You should use UI-Router. It's a well maintained community project that replace the basic ng-router.

It has a lot more functionalities than ng-router, including multiple views.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.