Hello.
I have two controllers with some similar functions/methods. So I think that
it should be a good idea to use an abstract controller, move these similar
functions/methods to an abstract controller and to inherit these
functions/methods in current two controllers.
I.e. I'd like to do something like:
function AbstractController() {
}
AbstractController.prototype.similarFunc1 = function() {
};
AbstractController.prototype.similarFunc2 = function() {
};
var Controller1 = function() {
AbstractController.call( this );
...(skipped)
};
Controller1.prototype = Object.create( AbstractController.prototype );
...(skipped)
var Controller2 = function() {
AbstractController.call( this );
...(skipped)
};
Controller2.prototype = Object.create( AbstractController.prototype );
...(skipped)
Is it a bad style or can I use such 'tricks'? :)
P.S. If idea is not bad then it would be great to have such info in
AngularJS docs. If idea is bad then it would be great to know the reason.
In any case such info may be useful here:
https://docs.angularjs.org/guide/controller
--
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.