Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I am looking for community advice on how to setup my first angular application.

I have multiple pages with shared functionality: - many filters are shared (location, status, etc) - each page has a grid with some overlap of columns, some specific to each page - each page has the data filtered differently

I created a service that manages the grid portion on each page so that's working great. Where I am struggling is how to bind the filters to the grid. I want to have faceted navigation and when a user clicks on a location I want to update the grid.

I have the following services:

  • CustomerModuleService (handles the grid functionality for all pages)
  • CustomerService (fetches customers via http)

I have the following controllers and their dependencies:

- CustomerFilterCtrl ['$scope', 'customerModuleService']
- PageOneCtrl        ['$scope', 'customerModuleService', 'customerService']
- PageTwoCtrl        ['$scope', 'customerModuleService', 'customerService']

An example of PageOne/PageTwo view is like this:

<div ng-controller="CustomerFilterCtrl">
    <location-filter></location-filter>

    <input type="text" ng-model="test"></input>
</div>

<input type="text" ng-model="test"></input>


<div id="grid1" ui-grid="gridOptions" ui-grid-paging ui-grid-resize-columns external-scopes="gridScope" class="grid" style="height: 700px;">
</div>

I am trying to find ng-model="test" between the two controllers as a proof of concept.

Could someone help me understand how to glue this type of behavior together in angular or possibly give suggests how to do it.

share|improve this question
    
Follow this link – mia Jan 11 at 4:56
    
Fat services with skinny controllers stackoverflow.com/a/25418541/1803298 – cheekybastard Jan 11 at 5:07
    
Really not clear what the specific issues are. One general rule of thumb to always abide by is having a dot in ng-model then you aren't binding primitives that don't have prototypical inheritance. ng-model="someObj.test" – charlietfl Jan 11 at 5:09
    
@charlietfl i remembered reading something about having a period not thinking it was too important, but I'll read up more on it to make sure I fully understand it. Sounds important! – ben Jan 11 at 5:25
    
yes it totally is and may be the glue you are missing. As soon as a child scope gets involved , primitives lose 2 way binding. Also sharing primitives across the app – charlietfl Jan 11 at 5:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.