Hi, Can u post an example.
On Sunday, December 16, 2012 at 5:05:29 AM UTC+5:30, Witold Szczerba wrote: > > Correct me if I am wrong, but your layout is static: you always have a > header, footer, side menu and main section. So your index.html may > look like this: > <div ng-include="layout.header"></div> > <div ng-include="layout.menu"></div> > <div ng-view></div> > <div ng-include="layout.footer"></div> > > Come up with your own "layout" service. It's role (also > implementation) is simple: to maintain the header, menu and footer > properties. Put the instance of that service to the scope accessible > by your ng-include directives, propably $rootScope (it is possible not > to pollute the scope, but it is not important right now). Your layout > service will be to your header, menu and footer what $route and it's > provider are for ng-view. > > Regards, > Witold Szczerba > > On 15 December 2012 23:06, Ryan Zec <[email protected] <javascript:>> > wrote: > > Well the thing is that the layout it not static, it requires access to > the > > scope in order to properly display information (the user's name in the > > header; whether or not the side menu should even shown and if it does, > what > > items to show; heck, some pages might have a completed different header > than > > other pages). > > > > > > On Sat, Dec 15, 2012 at 4:59 PM, Witold Szczerba <[email protected] > <javascript:>> > > wrote: > >> > >> Hi, > >> I would define the static layout in main html template (index.html most > >> ogre the time) and use the ng-include directives for semi-common > elements. > >> Then, the ng-view for the main section which depends on $route service. > >> > >> Regards, > >> Witold Szczerba > >> --- > >> Sent from my mobile phone. > >> > >> On Dec 15, 2012 5:00 PM, "Ryan Zec" <[email protected] <javascript:>> > wrote: > >>> > >>> I am trying to figure out the best way right now with the way routes > and > >>> views work to handle an application that is going to have a > semi-common > >>> header, footer, and side menu. What I mean by semi-common is that > most > >>> pages will share between a few different headers, footers, and side > menu and > >>> the data in them might be slight different however the basic HTML > structure > >>> is going to be the same. Right now all 3 elements are being defined > in the > >>> rootScope as variables that store the part to the template. This way > I can > >>> have a default value but each controller can override if needed. > There are > >>> one issues with this however: > >>> > >>> 1. Each template contains the same basic structure for including the > >>> header, footer, and side menu. These elements needs to have access to > the > >>> scope for data which from my understanding, means that it needs to be > inside > >>> the ngView (ie. I can't puut that structure into the index.html). > >>> 2. The header, footer, and side menu are being re-render everytime I > >>> switch pages (again, because it is part of the template for each page. > >>> > >>> Now the idea I have to solve the first issue (have not tested this out > >>> yet) is when defining my route, every route will use the same template > and > >>> then evey controller will define the path to the page specific > template. > >>> This way I only write the basic layout HTML once and then include the > page > >>> specific HTML through an include in the main layout template. Is this > the > >>> best way to handle this issue or is there another solution that might > be > >>> better? > >>> > >>> The second problem I imagine would still exist. Is there currently a > way > >>> to tel AngularJS to only re-render part of a view instead of the whole > >>> things? > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > Groups > >>> "AngularJS" group. > >>> To post to this group, send email to [email protected] > <javascript:>. > >>> To unsubscribe from this group, send email to > >>> [email protected] <javascript:>. > >>> Visit this group at http://groups.google.com/group/angular?hl=en-US. > >>> > >>> > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "AngularJS" group. > >> To post to this group, send email to [email protected] > <javascript:>. > >> To unsubscribe from this group, send email to > >> [email protected] <javascript:>. > >> Visit this group at http://groups.google.com/group/angular?hl=en-US. > >> > >> > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "AngularJS" group. > > To post to this group, send email to [email protected] > <javascript:>. > > To unsubscribe from this group, send email to > > [email protected] <javascript:>. > > Visit this group at http://groups.google.com/group/angular?hl=en-US. > > > > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
