Multiple ng:view on the same page.

Showing 1-35 of 35 messages
Multiple ng:view on the same page. Batman 9/14/11 3:54 AM
To build my next app I'm evaluating a number of JS frameworks and
AngularJS scores higher than any other framework.
I would like ask a number of design question.

1. Can we use multiple <ng:view> on the same page to render different
partials on different <ng:view> tags. For example If an app where
Parent menu item renders a partial in <ng:view> tag. The partial
itself has a number of navigation links and each needs to be open in
their own ng:view tags.

2. What is the best way for Inter-Controller communication. For
example if UserController wants to dispatch an UpdateUser event to
ProductController, what is the standard way in AngularJS. (kind of
observer pattern)

Re: [angular.js] Multiple ng:view on the same page. Misko Hevery 9/14/11 10:52 AM
See inline

On Wed, Sep 14, 2011 at 3:54 AM, Khurram <teg...@gmail.com> wrote:
To build my next app I'm evaluating a number of JS frameworks and
AngularJS scores higher than any other framework.
I would like ask a number of design question.

1. Can we use multiple <ng:view> on the same page to render different
partials on different <ng:view> tags. For example If an app where
Parent menu item renders a partial in <ng:view> tag. The partial
itself has a number of navigation links and each needs to be open in
their own ng:view tags.

<ng:view> is tied to $resource, and right now you can only have one. But you can have as many <ng:includes> as you want, but you have to do the wiring yourself.
 

2. What is the best way for Inter-Controller communication. For
example if UserController wants to dispatch an UpdateUser event to
ProductController, what is the standard way in AngularJS. (kind of
observer pattern)

Turn your long lived data into a service and inject it into the controllers.
 

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.


Re: [angular.js] Multiple ng:view on the same page. Witold Szczerba 9/14/11 11:47 AM
See inline:

On 14 September 2011 19:52, Misko Hevery <mi...@hevery.com> wrote:
> On Wed, Sep 14, 2011 at 3:54 AM, Khurram <teg...@gmail.com> wrote:
>>
>> 1. Can we use multiple <ng:view> on the same page to render different
>> partials on different <ng:view> tags. For example If an app where
>> Parent menu item renders a partial in <ng:view> tag. The partial
>> itself has a number of navigation links and each needs to be open in
>> their own ng:view tags.
>
> <ng:view> is tied to $resource, and right now you can only have one. But you
> can have as many <ng:includes> as you want, but you have to do the wiring
> yourself.

Little correction: <ng:view> is tied to $route, not $resource.
As to wiring - it is very straightforward in Angular :)

Regards,
Witold Szczerba

Re: Multiple ng:view on the same page. Batman 9/14/11 12:16 PM
I dont get your reply.

I know the basic functionality of $route and <ng:view>.

I'm curious how we can use two different <ng:view> on the same page to
load two different partials.
Re: [angular.js] Re: Multiple ng:view on the same page. Witold Szczerba 9/14/11 12:29 PM
That is the point: as Misko said - you cannot use <ng:view> for that,
use <ng:include> instead.

> --
> You received this message because you are subscribed to the Google Groups "AngularJS" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>

Re: Multiple ng:view on the same page. Magrelo 9/14/11 1:40 PM
You can have a <ng:include src="bind_to_url"></ng:include> that binds
to a variable on your controller. Then you can change this variable as
you want.


Thiago
Re: [angular.js] Re: Multiple ng:view on the same page. Igor Minar 9/14/11 8:39 PM
right, but we will support multiple ng:views per $route definition. check back in a few weeks.

/i
Re: [angular.js] Re: Multiple ng:view on the same page. ItsLeeOwen 4/13/12 7:09 PM
Has this feature been implemented?  In this example, I'm looking to route specific urls/templates to specific ng-views







Re: [angular.js] Re: Multiple ng:view on the same page. Igor Minar 4/13/12 10:48 PM
no. not yet. I experimented with it a bit but it got quite complicated and we decided to put on it for 1.0.

We do want the routing to be more sophisticated, it's just not going to happen for 1.0

/i

On Fri, Apr 13, 2012 at 7:09 PM, ItsLeeOwen <l...@coderebelbase.com> wrote:
Has this feature been implemented?  In this example, I'm looking to route specific urls/templates to specific ng-views







--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/d_FhDCmhXdUJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Re: [angular.js] Re: Multiple ng:view on the same page. Söderlind 4/14/12 8:23 AM
Try this:  http://jsfiddle.net/johaa1993/xsbWd/2/

Use it with ng-include. Note that you can check if its a number by using regexp or a text or whatever(*).
Re: [angular.js] Re: Multiple ng:view on the same page. Cary Landholt 5/6/12 1:34 PM
Igor - this is really a necessary feature.  What's your ETA on supporting multiple views for routing?
Re: [angular.js] Re: Multiple ng:view on the same page. Cary Landholt 5/6/12 1:36 PM
Söderlind - can you fix your JSFiddle link?  I'd like to take a look.
Thanks


On Saturday, April 14, 2012 10:23:02 AM UTC-5, Söderlind wrote:
Try this:  http://jsfiddle.net/johaa1993/xsbWd/2/

Use it with ng-include. Note that you can check if its a number by using regexp or a text or whatever(*).
Re: [angular.js] Re: Multiple ng:view on the same page. Tony Ouyang 7/2/12 6:27 AM
How can I have mutiple $route definitions? I can only see $route definition in module definition. And the only case to activate module for certain page region is ng-app declaration.
It results in that only one np-app declaration implies only one $route definition? Please point out my mis-understanding. Thanks!
Re: [angular.js] Re: Multiple ng:view on the same page. Carsten Kraus 7/2/12 10:22 AM
First of all: congrats on the framework and the 1.0 release!

We do want the routing to be more sophisticated
Are you thinking roughly in this kind of direction? Looks promising...

it's just not going to happen for 1.0
Really just my 2 cents, but: may I suggest to then take the feature out of angular-seed until you're done?
Like I just did, angular-seed is probably one of the first places people get their hands dirty with, when using Angular the first time.
The usage of route/view there then makes one think that views are a root concept in angular and really the next question that comes to mind, is how to multiply/nest views, then.
Re: [angular.js] Re: Multiple ng:view on the same page. numan 8/3/12 6:02 PM
Hi Igor, now that 1.0 is out, is this feature in there or has it been moved to later releases?
Re: [angular.js] Re: Multiple ng:view on the same page. Maxence Warzecha 8/4/12 3:45 AM
Really interested too.
Re: [angular.js] Re: Multiple ng:view on the same page. Roy Truelove 8/17/12 12:04 PM
+1
Re: Multiple ng:view on the same page. ebeltr...@gmail.com 10/25/12 1:16 PM
+1
Re: Multiple ng:view on the same page. Partap Davis 10/25/12 4:49 PM
+1

On Thursday, October 25, 2012 1:16:22 PM UTC-7, ebeltr...@gmail.com wrote:
+1
Re: [angular.js] Re: Multiple ng:view on the same page. peter....@gmail.com 11/1/12 5:34 AM
Is there any progress on supporting multiple views bound to the routing path? The workaround using ng-controller, manually parsing the routing path and binding the template via ng-include seems very cumbersome, if it works at all... 
Re: [angular.js] Re: Multiple ng:view on the same page. dlpor...@gmail.com 12/9/12 9:23 AM
I've been exploring angular got a grew days note Anne think it is very promising. However, until it supports multiple ng-views, I cannot seriously consider it for enterprise application.

Waiting with bated breath for this feature.

Thanks for ask you're work.

Re: [angular.js] Re: Multiple ng:view on the same page. dlpor...@gmail.com 12/9/12 9:26 AM
I've been exploring angular for a few days now and think it is very promising. However, until it supports multiple ng-views, I cannot seriously consider it for enterprise application development.

Waiting with bated breath for this feature.

Thanks for all you're work.

Ignore the previous post

Re: [angular.js] Re: Multiple ng:view on the same page. Michael Bielski 12/10/12 8:01 AM
I've been using Angular for several months now and found that I can get along just fine with only one ng-view on the page. Using ng-include as Misko suggested works very well and makes it easier to have things like navigation in a single file that can be updated once and propagated through the entire application. When you add in the ability to change what is referenced by an ng-include programmatically, the possibilities are now endless. For example:

<div ng-include="template" id="modalContainer" class="modal fade">
</div>

Now you can simply change the value of "template" and control what goes into your modal. Set "template" to a URL and tell the modal to show. Viola! Content that was loaded on-the-fly! When you're done, tell the modal to close and then clear the value of "template". Poof! It's gone! The whole thing is lightweight and flexible, just like Angular apps should be.
Re: [AngularJS] Re: [angular.js] Re: Multiple ng:view on the same page. Maxence Warzecha 12/10/12 8:33 AM
After several months working with Angular, I don't feel the need of mutliple ng-view anymore. I think that it may help but not so important after all (at least in my case!).


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
 
 



--
Maxence Warzecha | - 120, rue Dupont des Loges | F-57100 Thionville
( +33 (0) 6 64 69 41 70 | +33 (0) 3 82 88 05 89 | * war...@gmail.com

Re: [angular.js] Re: Multiple ng:view on the same page. Cary Landholt 12/10/12 7:46 PM
Like some of the others have commented, at first I thought this would be a really big pain.  But working with Angular for several months, I've not had a problem.
Re: [angular.js] Re: Multiple ng:view on the same page. edwardt...@gmail.com 1/10/13 9:12 AM
I would like to use ng-includes to get around the need for multiple (specifically: nested) views. However, I do have a requirement to be able to update the urls accordingly, like when using angular routes. Is there any way to do this?

On Monday, December 10, 2012 9:01:57 AM UTC-7, Michael Bielski wrote:
I've been using Angular for several months now and found that I can get along just fine with only one ng-view on the page. Using ng-include as Misko suggested works very well and makes it easier to have things like navigation in a single file that can be updated once and propagated through the entire application. When you add in the ability to change what is referenced by an ng-include programmatically, the possibilities are now endless. For example:

<div ng-include="template" id="modalContainer" class="modal fade">
</div>

Now you can simply change the value of "template" and control what goes into your modal. Set "template" to a URL and tell the modal to show. Viola! Content that was loaded on-the-fly! When you're done, tell the modal to close and then clear the value of "template". Poof! It's gone! The whole thing is lightweight and flexible, just like Angular apps should be.
Re: [angular.js] Re: Multiple ng:view on the same page. Bretto 1/13/13 2:59 PM
Yes, I had to circumvent this shortcoming too, point your route to a generic partial and a controller,in the partial have an ng-include and point to a property on that scope, in the controller setup that property from the  $routeParams. Does this makes sense ?
Re: Multiple ng:view on the same page. Bretto 1/13/13 4:46 PM
Partial:

<div id="experiment-wrap" ng-include="'experiment/'+appModel.currentItem.id"/>

Controller:

controllers.controller('ExperimentCtrl', function($scope, $rootScope, $log, AppModel, $routeParams, $location, LAYOUT){

        $scope.appModel.currentItem = getItemById($routeParams.id);
}

Routes:

when('/experiment/:id', {controller:'ExperimentCtrl', templateUrl:'partial/include-experiment'}).


does this help ?

On Wednesday, 14 September 2011 20:54:39 UTC+10, Batman wrote:
To build my next app I'm evaluating a number of JS frameworks and
AngularJS scores higher than any other framework.
I would like ask a number of design question.

1. Can we use multiple <ng:view> on the same page to render different
partials on different <ng:view> tags. For example If an app where
Parent menu item renders a partial in <ng:view> tag. The partial
itself has a number of navigation links and each needs to be open in
their own ng:view tags.

2. What is the best way for Inter-Controller communication. For
example if UserController wants to dispatch an UpdateUser event to
ProductController, what is the standard way in AngularJS. (kind of
observer pattern)

Re: Multiple ng:view on the same page. Luka Mirosevic 1/31/13 6:54 AM
I've written a small stateManager which does a kind of very simple "routing" allowing for nested views, deep linking, etc

For those that are interested: https://github.com/lmirosevic/angular-stateManager


On Wednesday, September 14, 2011 12:54:39 PM UTC+2, Batman wrote:
To build my next app I'm evaluating a number of JS frameworks and
AngularJS scores higher than any other framework.
I would like ask a number of design question.

1. Can we use multiple <ng:view> on the same page to render different
partials on different <ng:view> tags. For example If an app where
Parent menu item renders a partial in <ng:view> tag. The partial
itself has a number of navigation links and each needs to be open in
their own ng:view tags.

2. What is the best way for Inter-Controller communication. For
example if UserController wants to dispatch an UpdateUser event to
ProductController, what is the standard way in AngularJS. (kind of
observer pattern)

Re: Multiple ng:view on the same page. Dave Merrill 1/31/13 6:58 PM
Looks very interesting.

Sorry for the lazy question, but I haven't had a chance to look much at the code, and I see that the repo contains both jQuery and ruby. Are they for the demo and/or build, or are they needed to use this in an app?

Thanks,
Dave
Re: [AngularJS] Re: Multiple ng:view on the same page. Luka Mirosevic 1/31/13 10:01 PM
The ruby code is just to bootstrap the demo (and serve the partials from haml).

In your app all you'd have to do is copy the code of the actual service (the factory method) into your app. It's only about 70 lines iirc. 

Luka
--
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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Re: [AngularJS] Re: Multiple ng:view on the same page. Dave Merrill 2/1/13 4:31 AM
Does it require jQuery, or is that also just for the demo?

Thanks,
Dave
Re: [AngularJS] Re: Multiple ng:view on the same page. Luka Mirosevic 2/1/13 10:33 AM
Just for the demo. 

It was actually just used for selecting the title element (once) so I've refactored that to use native js only and remove the jQuery dependency from the demo.

Luka
Re: [AngularJS] Re: Multiple ng:view on the same page. Dave Merrill 2/1/13 11:44 AM
Thanks for clarifying. If it was just for that one thing, removing the dependency's a good idea (:-).

Dave
Re: Multiple ng:view on the same page. Allen Emanuel 7/5/13 1:42 AM
I too stuck up with this problem and i found Angularjs-ui-router which solve this problem as of now.
More topics »