0

I've tried to find the answer to my problem with no luck. I'm new to web development and I've been trying to create a simple app using angularjs and bootstrap. There's no much content on my pages, only a couple of inputs and buttons that do nothing. I placed ng-view in the index.html page as I saw in many tutorials and that allows me to navigate to all my pages. I'm trying to add a navigation bar to all my pages once a user logs in, so I placed another ng-view on my home(page after user logs in), but it seems that angular allows only one view for each app. And also it doesn't allow nested app. If I'm wrong, please correct me (that's what I understood from my Google 'research'). So, my question is: how can I add a navigation bar(or any same html content) to all my pages after the user logs in without copying the same code in each html page? Btw, I had this working with jQuery, but I don't know how to do it using angularjs Thanks!

Rohit Azad Malik
  • 31,410
  • 17
  • 69
  • 97
monica
  • 472
  • 3
  • 8
  • 18
  • [ng-include](https://docs.angularjs.org/api/ng/directive/ngInclude) or [ui-router](https://github.com/angular-ui/ui-router) are the most common. – Rob Oct 06 '14 at 04:50
  • Possible duplicate: http://stackoverflow.com/questions/18391727/how-to-implement-a-navigation-bar-in-angularjs – Sameer Shemna Oct 06 '14 at 04:54
  • Also, consider using [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap/). – cvrebert Oct 06 '14 at 05:30
  • @Rob I tried with ng-include and it did what I needed. A snippet of html in each page. Thanks! – monica Oct 06 '14 at 06:00

1 Answers1

0

You can use Angular Directive that use a template to create a custom tag and you can use a controller only for this directive. Call this tag to all pages when logging.

Kevin Hernández
  • 704
  • 10
  • 25