I instantiate a function from my template with
new Product.Image({
"title": document.querySelector('#image-title')
});
But now I need to extend "Product.Image" e.g. with "Product.BetterImage"
new Product.BetterImage({
"title": document.querySelector('#better-image-title')
});
My original class starts like this:
Product.Image = function (options) {
//do something
}
Product.Image.prototype = new Product.Data();
Now I tried to copy it to extend "Product.Image":
Product.BetterImage = function (options) {
//do something
}
Product.BetterImage.prototype = new Product.Image();
But when I call my template to initiate it I got the following error:
Uncaught TypeError: Product.BetterImage is not a constructor
What am I missing here or what have done wrong? Can anyone explain me what's wrong here?