Hi everyone,
I am pretty new to Angular, and while it feels like very powerful tools, I
can not find the instrument in it that fits my current task in native
Angular (I only found an extension called angular-route-segments, which
seems to be what I need, but I thought there might be an easier solution).
In my web app, I have the menu and upper part of the page persistent, while
description part of the page is dynamic and changes, whenever I switch
active menu items. Currently, my implementation is such:
Each menu item invokes a description-controller on my page, which fills its
own html template with data, which is loaded dynamically from json file.
So, whenever the user clicks other menu item, different json data is loaded
and filled into template on the page. This is cool, as it lets the initial
page be lightweight. However, there are 2 things that I don't like:
- JSON is strictly bound to the controller's template html, obviously.
So every page that I load has to have the same layout (or I have to
significantly complicate the template with conditions, which is far from
being a good practice.)
- No routing used -> users can not actually got to any page of the
website with a hardlink, like example.com/foo. The website is really just
one page "example.com/" with different JSON content.
So, I would think my solution would be to use Angular routing. However, as
far as I understand, it only lets me replace all the page content with
different template. Is there a way to actually bind route (like
.when('/foo')) update to just *specific* page part (e.g. div with "content"
class or even custom directive), so that different html templates would be
loaded and "injected" into the page segment only while the specific menu
item clicked? And what would be a good practice from Angular point of view
in this situation?
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.