AngularJS Gothenburg Message Board › Nested Views, or rather application structure for a angularian-noob

Nested Views, or rather application structure for a angularian-noob

Fredrik W.
FredrikWendt
Göteborg, SE
Post #: 11
Trying to get my hands dirty (gah - why do all screencasts not use remote data fetching/storing, and "nested views") and I'm a little stuck, so - why not use the local community?

I'd like to see and play with other people's ways of achieving what in other frameworks would be "nested views". I see the point some people are making about "angular is data driven", but that usually just words and very little code, which doesn't really help with binding different URLs and Routes :-P

The specific case I'm solving is this: I have a system with UserGroup entities, which contains Events, which contains Attendees. The URL patterns used, have been in this admin UI, are:
# - shows a dropdown of all UserGroups in the system, selecting one moves on to:
#/{groupId}/ - shows list of events in that group. clicking one of the moves on to:
#/{groupId}/{eventId}/ - which shows a list of people that have signed up to attend that event. Clicking one of the attendees:
#/{groupId}/{eventId}/{attendeeId} - which shows details about the selected event attendee.

The JavaScript side here was hand coded, but mapped almost 1-to-1 on the backing JSON HTTP API.

I guess I could just use:
#/group/:id
#/event/:id
#/attendee/:id

with three different controllers and three shared services/providers/factories and three directives. It's just that I'd have to redo the data models being served now, and I'm a little too lazy for that I assume - I guess you could say I'm looking at the data from the wrong Angle? :-)

(The HTTP JSON API is used by an android app so if possible, I'd just like to re-use what's there.)

So, if someone would like to share insights, or play with code like this - I'd be happy to provide venue (Squeed's office at Grönsakstorget). For me late work hours like 1600-1800 is an easy fit, everything else means I need to talk to the boss (wife).

Similar example app: http://angular-ui.git...­

/ Fredrik
Tom S.
user 4532993
Falkenberg, SE
Post #: 1
Hello Fredrik,

I'm not sure I understand the issue here but it sounds like paragraph 3 describes the currently available routing scheme and you don't want to change that. If my understanding is correct then why not just use it? There is no need to use the scheme you have in paragraph 5. If this is the issue I would be happy to give you an example.

The reason I think I might be missing something here is because your example at the bottom is using the Angular "ui-router" for state management. And your mention of "nested-views" which is inherent in "ui-router". Are you seeing some problem there?

/Tom

Fredrik W.
FredrikWendt
Göteborg, SE
Post #: 12
My problem: AngularJS doesn't provide state management (or nested views) out of the box, or does it?
My question: How would you do what the ui-router extension does with vanilla AngularJS? (or perhaps some other extension, convention, mushrooms, ...)
Tom S.
user 4532993
Falkenberg, SE
Post #: 2
Fredrik,
I just came across this, hope it is useful.

http://www.bennadel.c...­

/Tom
Fredrik W.
FredrikWendt
Göteborg, SE
Post #: 13
Thanks Tom! Quite a mouthful with all the comments.
I'm going to try out the ui-router, naïvely hoping that something from the core library is addressing this after the summer break/vacations. :-)
Powered by mvnForum

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy