i'm trying to inherit properties from one constructor function in other constructor function.
I have my Event constructor function:
var Controller = require('./controller');
var Event = function() {
this.element = 'element';
Controller.call(this);
};
var event = new Event();
And my Controller constructor function:
var Controller = function() {
console.log(this.element) // prints 'element'.
this.method(); // < error
};
Controller.prototype.method = function() {
console.log(this.element);
};
module.exports = Controller;
I already can access the Event properties and methods in the Controller, but i can't create my own controller methods.
Can by solved?
Thanks.