Question of day

5 views
Skip to first unread message

Aalap Shah

unread,
Mar 9, 2016, 8:45:26 AM3/9/16
to Elite Techie Group
As we all know angular js is one of the best option when you design for single page applications.

Let's consider you need to use it for multi page application,
What will be best architecture (considering angular controllers, modules, directives, services/factories/validation)

pate...@gmail.com

unread,
Mar 9, 2016, 9:39:10 AM3/9/16
to elite-tec...@googlegroups.com
I don't know much abt Angular ,started learning.
As far as I know Single Page (SPA) application that is experience from users perspective.
User won't see refresh the page on each action ,as a developer we still need to follow the same MVW architecture.

Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "Elite Techie Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to elite-techie-gr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

pate...@gmail.com

unread,
Mar 9, 2016, 9:40:28 AM3/9/16
to elite-tec...@googlegroups.com
Also I believe you have to use routing to route request one to other page using angular routing

Sent from my iPhone

> On Mar 9, 2016, at 8:45 AM, Aalap Shah <shah.aa...@gmail.com> wrote:
>

BHAVIN SHAH

unread,
Mar 9, 2016, 11:00:26 AM3/9/16
to Elite Techie Group
I agree with Nirav, MVW because in most of the situation we as a developer use the combination of MVC with simple view or sometimes use MVVM combination of viewModal to combine multiple dataobjects for single view. 


 

On Wednesday, March 9, 2016 at 9:40:28 AM UTC-5, Nirav Patel wrote:
Also I believe you have to use routing to route request one to other page using angular routing

Sent from my iPhone

> On Mar 9, 2016, at 8:45 AM, Aalap Shah <shah.aa...@gmail.com> wrote:
>
> As we all know angular js is one of the best option when you design for single page applications.
>
> Let's consider you need to use it for multi page application,
> What will be best architecture (considering angular controllers, modules, directives, services/factories/validation)
>
> --
> You received this message because you are subscribed to the Google Groups "Elite Techie Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to elite-techie-group+unsub...@googlegroups.com.

Aalap Shah

unread,
Mar 9, 2016, 11:03:52 AM3/9/16
to elite-tec...@googlegroups.com
I am talking about higher level architecture.
1. Architecture will change over client side based on single page or multi page apps.
2. MVVM is the one which angular uses by default.

Thanks and Regards,
Aalap Shah

> To unsubscribe from this group and stop receiving emails from it, send an email to elite-techie-gr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Elite Techie Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elite-techie-group/U6AYOAj6n3M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elite-techie-gr...@googlegroups.com.

Jignesh Gor

unread,
Mar 9, 2016, 11:30:34 AM3/9/16
to elite-tec...@googlegroups.com

UI layer will split here....UI layer and UI services layer....UI will be just html  and JavaScript behavior files for each page and UI logic layer will have common scripts such as module services directives....

Aalap Shah

unread,
Mar 9, 2016, 11:34:51 AM3/9/16
to elite-tec...@googlegroups.com
Let me tweak question,
1. What is best possible way to pass data/call events between controllers ?
2. how can you make sure that there is only one instance of controller ?

Thanks and Regards,
Aalap Shah

Aalap Shah

unread,
Mar 9, 2016, 11:35:15 AM3/9/16
to elite-tec...@googlegroups.com
In Angular JS.

Thanks and Regards,
Aalap Shah

SHAH BHAVIN

unread,
Mar 9, 2016, 3:22:29 PM3/9/16
to elite-tec...@googlegroups.com
1. What is best possible way to pass data/call events between controllers ?
there are two ways to pass data using Service or UI Router.
2. how can you make sure that there is only one instance of controller ?
NOT Sure the Ans but may be by replacing service to factory you can make sure that it will use one instance of a controller. 

Aalap Shah

unread,
Mar 9, 2016, 6:14:12 PM3/9/16
to elite-tec...@googlegroups.com
Services are not meant to pass data between controllers, it's wrong approach.
I have no idea about UI routers.

Didn't get your second answer, can you explain it? You 

Jignesh Gor

unread,
Mar 9, 2016, 6:37:43 PM3/9/16
to elite-tec...@googlegroups.com

Bhavin suggestion is Angular Factory and Services difference....Whether you want single instance or multiple...based on that Angular provides 2 approach on Angular Services and Factory....

Agreed, Controllers do not talk directly or through services....but through modules...

Jignesh Gor

unread,
Mar 9, 2016, 6:44:38 PM3/9/16
to elite-tec...@googlegroups.com

Also,

Controllers should not talk to each other...else they are breaking design....it is simple...there should not be any scenario where they need to talk each other....

UI router is routing framework...similar to RequireJS but with some differences....such as partial views and div loading etc...

Aalap Shah

unread,
Mar 9, 2016, 7:46:22 PM3/9/16
to elite-tec...@googlegroups.com
Ok so the question still remains open then,
how should we communicate between controllers ? and how to make sure of only one instance of controller in view  ?

for communication, we can use parent child controller relationship where child controllers can access data through parent controller
or from $rootScope (which is not preferable)

for single instance, i am still looking for options.

Thanks and Regards,
Aalap Shah

Jignesh Gor

unread,
Mar 9, 2016, 8:46:16 PM3/9/16
to elite-tec...@googlegroups.com

Nopes...you are breaking the design concept...Controllers cannot communicate with each other....parent child controller concept is not for this purpose...

Aalap Shah

unread,
Mar 9, 2016, 9:52:02 PM3/9/16
to elite-tec...@googlegroups.com
Which design concept? 
How about I share it via events ?

Aalap Shah

unread,
Mar 10, 2016, 4:47:59 PM3/10/16
to elite-tec...@googlegroups.com
i just found that assigning controller to ng-template, used to create new instance of controller.

Thanks and Regards,
Aalap Shah

Jignesh Gor

unread,
Mar 10, 2016, 6:51:18 PM3/10/16
to elite-tec...@googlegroups.com

Let me put it this way.... In Asp.net MVC, an action can take us to other controller...and alongwith it you can pass json, string or etc. But you cannot create instance of another controller and access its members...it doesn't stop but not designed for that....definition of controller is bound to its models and views....

Angular is MVW, whatever doesn't literally means do whatever..... ;-) just kidding on a lighter note...take it easy... :-)

One more thing, I don't understand this  scenario....why would one controller needs other controllers instance....this will not even required in partial view scenario....

I agree that....that is not within the scope of rootscope ;-)

Swami, still learning .... Waiting for Angular 5 ;-)  :-) We never said that...In this group we only post based on experience...we were stretching tech boundaries and learning new stuff and sharing and clearing doubts.... Remember covariance and contravariance....we didn't implement in past and till date....but we were learning...so now on...this reply will only put additional weight on other members...please enlighten our knowledge pool with your magical mind... ;-)

I am on python django pandas R eclipse jira qunit karma djangocms but still not losing touch with Billu saheb...jaag jao mitra :-)

Aalap Shah

unread,
Mar 11, 2016, 10:38:02 AM3/11/16
to elite-tec...@googlegroups.com
:) angular controllers are totally different than MVC controllers and their architecture is also different!!

So we can't compare controllers or anything between those.
Angular is MVVM not MVW. Which follows same architecture like silverlight.

SHAH BHAVIN

unread,
Mar 11, 2016, 10:46:55 AM3/11/16
to elite-tec...@googlegroups.com
http://www.ramandv.com/blog/angular-js-sharing-data/

Sharing data - between controllers


1. Sharing data between Parent scope and Child scope
2. Sharing data using Service [like a global variable]
3. Sharing data using Service – monitor the changes



Aalap Shah

unread,
Mar 11, 2016, 10:53:22 AM3/11/16
to elite-tec...@googlegroups.com
Thanks bhavin

3rd one, register event and broadcast it when needed, i've implemented that in my current project i wasn't sure about parent child at that time.

Thanks and Regards,
Aalap Shah

SHAH BHAVIN

unread,
Mar 11, 2016, 11:57:10 AM3/11/16
to elite-tec...@googlegroups.com
Jignesh,

I think we have used this functionality in our project (Sharing data using Service [like a global variable]) we had created service and we using this as a global variables. 

Thanks Aalap,
Can you share more information about your project architecture. How you are communicating from View to DB? 
Reply all
Reply to author
Forward
0 new messages