I want to use the vm convention of controllers writing. The problem is that I faced with is inheritance, for example lets assume I have the following:
Base Controller:
angular.module('app')
.controller('BaseCtrl', BaseCtrl);
function BaseCtrl() {
var vm = this;
vm._privateVar = 1;
}
BaseCtrl.prototype.foo= function() {
console.log('foo')
};
Child Controller:
angular.module('app')
.controller('ChildCtrl', ChildCtrl);
function ChildCtrl() {
var vm = this;
}
ChildCtrl.prototype.goo= function() {
console.log('goo')
};
Note:
I have an access to injection only within the ChildCtrl function:
function ChildCtrl(/*I can inject here only*/) {
var vm = this;
}
Also, The BaseCtrl is not a global class/function/object. Is there is any whay to inject the controller service outside of the controller function?
How should I make ChildCtrl
inherit form BaseCtrl
?
Thanks!