| There is really no need for this. It adds nothing imo but another layer of sauce over what angular already does properly. If your controllers are getting huge, go refactor into directives and services. I don't see how this would help since there isn't even inheritance? also: app.controller('AppCtrl', ['$scope', '$location', '$http'], function($scope, $location, $http) {
// ...
}]);
vs app.classy.controller({ name: 'AppCtrl', inject: ['$scope', '$location', '$http'],
//...
});
Congratulations, you have saved absolutely nothing (10 bytes? ) and just made it harder for me to understand your angular app.One of the brilliant things about angular is that it provides a proper structure that anyone that needs to write angular needs to adhere to. If you start introducing layers upon layers of funkyness and glitter, you'll end up with something non-angular. what I mean by that is: Classy introduces new conventions in a frameworks that already has a lot of conventions to keep track of while coding, and my biggest argument against this is that you introduce a dependency to Classy for all code based upon it, therefore you've created an extra layer of complexity to fix and track down when angular changes. In my mind effort like this should go into the angular core to make it better. |
Edit:
> One of the brilliant things about angular is that it provides a proper structure that anyone that needs to write angular needs to adhere to
Angular doesn't provide structure for controllers, they are just javascript functions. If you want to add structure it is up to the individual developer to decide how to do it. Classy is just the way that I like to do it, Classy is opinionated so it won't be for everyone.
By the way, you can do inheritance but I haven't documented and fully tested it yet.