Awesome, Thanks Tito.  I didn't mean to take it down a different path like 
that.  

Bringing it back to how to format the angular setup on the front end. 
 Would you recommend two separate angular modules (companies, contacts) and 
a service to share data?  What data would I be sharing?  Am I looking at a 
companies service that would provide to the company id so I could fetch the 
contacts specific to that company for a company specific page?  Or instead 
would the companies modules have a contacts module dependency so that I 
could access contacts from the companies controller?

Again please forgive my inexperience with Angular.  I feel like I'm close 
to figuring out the best way to do these things, but am not quite there 
yet.  

Thanks!


On Tuesday, March 29, 2016 at 10:54:12 PM UTC-4, Tito wrote:
>
> I think it depends on so many things. but it would just be one call that 
> could bring everything or it could be done in pieces (for performance 
> issues)
> Maybe the initial load brings only companies and then as you click each 
> company the subset of contacts are called based on companyID. You could do 
> it in one sweep where you bring back a companyContacts json blob that when 
> you click a next button or an alphabet filter will bring the next set of 
> companyContacts json blob. Maybe some caching to make the next fetch 
> faster? does the data change that often? etc etc
>
> thousands of ways to skin the cat depends what you want to do. performance 
> etc.
>
> On Tuesday, March 29, 2016 at 12:22:21 PM UTC-7, [email protected] 
> wrote:
>>
>> Hey Tito,
>>
>> Thanks for the reply.  
>>
>> To answer your questions.  It is full MEAN stack app.  So node, express, 
>> and Mongo backend.  Correct, it is setup as a REST web api.  
>>
>> Would that route be front end and show company specific details and that 
>> company's respective contacts? (makes one call to back end to grab 
>> everything?)
>>
>> Regarding the service, would that be contacts service that could be 
>> injected into the companies module and would share respective contacts for 
>> the company?  Would the contacts module be a dependency of companies 
>> modules still or would they be separate modules that share contact data via 
>> the contacts service?
>>
>> Thanks again for the help!
>> Sean
>>
>>
>>
>> On Tuesday, March 29, 2016 at 12:22:29 PM UTC-4, Tito wrote:
>>>
>>> Sean,
>>>
>>> I agree with Sander, service is the way to go. Question for you to 
>>> attempt a good answer.What is your backend: mysql, mongod, mssql?
>>> Also are you getting your data via an rest api using for example: 
>>> express.js? One of your routes could be /companyContacts which will join 
>>> company and contacts
>>>
>>> That would be my approach
>>>
>>> On Tuesday, March 29, 2016 at 9:05:58 AM UTC-7, [email protected] 
>>> wrote:
>>>>
>>>> Hey Sander,
>>>>
>>>> Thank you for your response.  That does make sense to me.  So would it 
>>>> be something like this?
>>>>
>>>> //companies module
>>>> angular.module('companies', ['contacts']);
>>>>
>>>> //contacts module
>>>> angular.module('contacts',[]);
>>>>
>>>> So when I setup the html page via the 'companies' controller I should 
>>>> have access to the 'contacts' $scope ?  When I am on a specific company 
>>>> page I'll know the company id and can make a request to my api to gather 
>>>> just the contacts associated with that company and display them on the 
>>>> same 
>>>> page?  
>>>>
>>>> Thanks again for your help!
>>>> Sean
>>>>
>>>> On Tuesday, March 29, 2016 at 6:12:25 AM UTC-4, Sander Elias wrote:
>>>>>
>>>>> Hi Sean,
>>>>>
>>>>> The usual way to solve this, is load all modules you need in your app 
>>>>> (your app being another module that includes the needed modules and is 
>>>>> otherwise (as good as) empty.
>>>>> You can then access all services from all of your modules wherever you 
>>>>> see fit. 
>>>>>
>>>>> Conclusion, load all modules, and communicate between components 
>>>>> <https://docs.angularjs.org/guide/component>through services.
>>>>>
>>>>> If you still have questions, don't hesitate to ask them!
>>>>>
>>>>> Regards
>>>>> Sander
>>>>>
>>>>

-- 
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to