I created a directive to monitor a group of checkboxes, and make sure that at least a minimum specified number would be selected. It works well, even if i use multiple instances on a page, as can be seen in the example below. 'CheckboxGroups' are formed by passing an array of objects from, and maintaining a binding relationship with, the parent controller scope objects.
Example: http://jsbin.com/cados/2/edit What I now want to do is extend the functionality so that all 'CheckboxGroups' are monitored and the form submit button disabled when any one of the groups is invalid. As each group is an independent entity, I'm trying to come up with a solution that fits *the angular way* Sidenote: I was able to achieve the functionality I was looking for first by adding scope variables into the parent controller, but this approach was obviously not ideal. So, the next approach I took is to create another directive that wraps the groups. The checkboxgroups directive now requires the formwatcher directive. The formwatcher's role is to provide a place for each checkboxgroup to register itself with, and also update its 'isValid' status every time it changes. Then, the formwatcher has its own method to assess the status of all checkboxgroups to assert whether the form can be submitted or not. This is where I have got stuck with developing the solution. Error: [$injector:unpr] Unknown provider: $elemProvider <- $elem http://jsbin.com/cados/4/edit I'd like to know if a) I'm going about this the right way b) how to resolve the error I'm getting -- 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 http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
