Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I manage several views in angular.js

Tags:

angularjs

I have the following page layout:

Diagram

  1. is the main menu
  2. is the top menu
  3. is the content [EDIT: Whoops it seems that I've lost some numbering, section 3 is the large middle section :)]

I would like to have separate sections to be managed (handled) by a separate modules (which seems logical), so how do I do that if I have only one ng-view that does handling of whole page view. How does one bind a module to a separate ui section?

Thank you in advance

like image 284
Lu4 Avatar asked May 20 '13 22:05

Lu4


People also ask

Can we have multiple controllers in AngularJS?

An AngularJS application can contain one or more controllers as needed, in real application a good approach is to create a new controller for every significant view within the application.

Can angular have multiple pages?

Angular is optimized for single-page applications (SPAs), but with a few simple steps it can also be used to display several applications on one page, a "multi-page application", so to speak. Lazy loading and shared code parts are even included!

Can we use multiple Ng app in AngularJS?

The first ngApp found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document you must manually bootstrap them using angular. bootstrap instead. AngularJS applications cannot be nested within each other.

What is correct way to apply multiple filters in AngularJS Mcq?

What of the following is the correct way for applying multiple filters in AngularJS ? Explanation: The correct syntax for applying the multiple filters is{{ expression | filter1 | filter2}}.


1 Answers

Define your main menu and top menu as directives and only the main content as the ng-view container. A directive has a dedicated template and controller and helps to achieve code modularity.

like image 186
Gregor Avatar answered Sep 20 '22 07:09

Gregor