Paraphrased from @jelbourn in this slideshow, there are 3 ways:
- Inheritance
- Mixins
- Object Composition
Pages 14, 15, and 16 in the slides talk about these options in more depth.
What he ends up recommending (if I understand correctly) is using #3 Object Composition most of the time and treating controllers and services like classes:
app.ZipCodeFieldController = function(){}
app.ZipCodeFieldController.prototype.autocomplete = function() {}
You can then mix in prototypal controllers:
app.PaymentFormController = function($scope, ZipCodeFieldController, $controller) {
$scope.zipCode = $controller(ZipCodeFieldController)
}
And use them in the template neatly:
<input type="text" name="zip" ng-change="zipCode.autocomplete" ng-model="zip" />
He also has a bit about very granular modules on slide 24 that is interesting.
Also good: https://github.com/yeoman/generator-angular/issues/109
There's a segment on object organization at the ng-conf talk on writing massive Angular apps at 15:14 in the video: