When creating balloonContentLayout using templateLayoutFactory :

 ymaps.templateLayoutFactory.createClass(` <div> BALLOON </div> `, { build: () => { BalloonContentLayout.superclass.build.call(this); }, clear: () => { BalloonContentLayout.superclass.clear.call(this); } }); 

Balun is positioned in the upper left corner with empty content, and when you try to close, Uncaught TypeError: Cannot read property 'destroy' of null falls out Uncaught TypeError: Cannot read property 'destroy' of null

But if you do not pass the second argument, then everything works correctly. Where is the mistake?

Jsfiddle example

    1 answer 1

    Case in context. The arrow functions during creation retain their context, and in ordinary ones it floats depending on how they are called. Do this:

     build: function(){ BalloonContentLayout.superclass.build.call(this); } 

    http://jsfiddle.net/10ak5dhc/