AngularJS common controller functionality - mix-in where needed or define on $rootScope?
问题 I am using v1.2.0 rc2 of AngularJS and want to know what is the best method to provide common functionality to multiple controllers. I have the following validation functions that I want to use in all controllers that edit a model: $scope.canSave = function (formController) { return formController.$dirty && formController.$valid; }; $scope.validationClasses = function (modelController) { return { 'has-error': modelController.$invalid && modelController.$dirty, 'has-success': modelController.