Open ns6482 opened 9 years ago
Maybe something like this:
function defaultComponents(mainView) {
var components = {
'headerView': 'header',
'navigationView': 'navigation',
'mainView': '',
'footerView': 'footer'
};
components.mainView = mainView;
return components;
}
AppController.$routeConfig = [{
path: '/',
components: defaultComponents('home')
}, {
path: '/detail/:id',
components: defaultComponents('detail')
}];
That would workm. Thanks
While this works, it didn't seem scalable...
Sent from my iPhone
On Apr 24, 2015, at 3:03 PM, Nehal Soni notifications@github.com wrote:
That would workm. Thanks
— Reply to this email directly or view it on GitHub.
Not sure I understand why, If this was a common module, could you expose the function via a service
For instance, if you have 3 common routes (views?) Header, nav, footer and 10 others (or more as nested views could have additional views) it would be nice to set only those that you want changed instead of passing a loaded object to a reusable function that returns your components object.
On my phone so hard to outline and example so hopefully this makes sense. If not I'll try to mock something up as soon as I can.
Sent from my iPhone
On Apr 24, 2015, at 3:09 PM, Nehal Soni notifications@github.com wrote:
Not sure I understand why, If this was a common module, could you expose the function via a service
— Reply to this email directly or view it on GitHub.
Question: would using an es6 extends work here?
I want to create a common template project, that has the typical header, footer navigation etc. So you can imagine routes defined like this...
How can I avoid duplicating the components in the path. Is it possible to set it generically. If you can imagine I want to create an equivalent to rail's layout, yield, or .net's master page.