-1

link to example: https://plnkr.co/edit/Z7BgBWeSStMuIrYBR3tS?p=preview

Here two states are defined. 1. home , 2. about

home has 1 view viewA

about has 2 views viewA and viewB but viewB is a sub part of about page. I want to show viewB inside of about.html page and not on index page. Is this possible. Please provide a plunkr link thanks.

what is the best practice if there are various views and each view has sub states

2
  • 2
    There is literally a section on this in the documentation Commented Mar 4, 2016 at 11:48
  • not able to understand from that its complicated. can you give a simple answer here Commented Mar 4, 2016 at 11:52

1 Answer 1

2

You can include your page 'about-sub-level.html' inside 'about.html' using ng-include like as-

<h1>I am about page</h1>
<div ng-include="'about-sub-level.html'"> </div>

Change your routing like below-

 .state('about', {
            url: "/about",
            views: {
                "viewA": {
                    templateUrl: "about.html"
                }
            }
        })

Hope this may help you..

Sign up to request clarification or add additional context in comments.

1 Comment

ok this works but is it possible to give states for about say about.sub-about...so that i do not have to give ng-include. I mean nested states for about page.. i know its possible but its complicated in documentation. i am not able to get that. Pls give demo for that way also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.