Ng-view nesting in angularjs

I am trying to have two angular applications on the same page.

my scenario: I have a website with many applications. therefore, for example, the title, footer, left sidebar, right sidebar will not change for the entire web page, only the content will change. so i used angular templating (ng-view). By clicking on the application as a calendar, it will be loaded into ng-view. in the calendar application I have ng-view for different views (month, week, day) so it will be like

<ng-view> calendar or some other app <ng-view> month or week or day or SOMEOTHER APP TEMPLATE </ng-view> </ng-view> 

when i tried this, the browser crashed. Is there any way to achieve this?

+4
source share
1 answer

ngView is associated with $routeProvider , which means that it is updated according to the current route / uri. It also means that you cannot bind two different views to the same URI.

You can simply use ngInclude with the url you want to show. It works the same as ngView in terms of fetching from the server.

You will not download all 3 URLs at once, if you just provide the URL, it will be received on demand.

However, in most applications it is better to serve all possible static files at the same time and then cache them, which will lead to better performance; only the initial load will suffer a little; which is better than a slow application in general.

I would rather wait another 2 seconds if this makes the whole application respond faster.

+1
source

All Articles