1

Lets see if I can describe my setup here...

I'm designing an angular app, as of now everything is all one page. Basically, when the user clicks a button, the controller sets which

"<ng-include>"

tag is visible. So my html looks something like this.

<html ng-app= "myApp">
    <head>
        <!-- header stuff -->
        <!-- all the includes and everything -->
    </head>

    <body>
        <div>
            <!-- page nav bar, its a lot of html but it works -->
        </div>

        <!-- content area -->
        <div ng-show= "showHome">
            <ng-include= "home.html">
        </div>
        <div ng-show= "showProfile">
            <ng-include= "profile.html">
        </div>
        <!-- etc... -->

    </body>
</html>

And then in my controller, I'm just setting the proper "showHome", "showProfile", etc... as appropriate. My question is, this seems like a terrible way to scale, and this is my first attempt at an app like this.

So to reiterate. I want to give the user the appearance of a single page app, while swapping in html templates. Any ideas? Multiple pages would be ok, but I want to keep the same navbar at the top of every page.

5
  • 1
    why don't you use UI routing. joelhooks.com/blog/2013/07/22/… Commented Sep 2, 2014 at 0:23
  • 1
    go to tutorial on docs site and see how ng-view works along with $routeProvider Commented Sep 2, 2014 at 0:23
  • 1
    Have a look at this: docs.angularjs.org/tutorial/step_07 Commented Sep 2, 2014 at 0:24
  • thanks guys. This is a good first step Commented Sep 2, 2014 at 0:25
  • To everyone, I should mention that this app uses a flask/jinja backend, although I'm not sure the difference that makes. Commented Sep 2, 2014 at 0:26

1 Answer 1

2

I'd use ui-router instead.

It is a popular alternative for ngRoute and supports nested templates really well.

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

1 Comment

ui-router has a lot of great features and functionality currently lacking in ngRoute

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.