Hi, I have a strange error, I don’t getting every time, but usually this error appears just after a hot-code push update, the error I’m getting is:
Uncaught Error: Must be attached
and it usually comes after I receive this errors:
Exception from Tracker recompute function:
TypeError: Cannot read property 'removeClass' of null
The first error comes when I try to click on an image using an event like so:
Template.categoriasShow.events({
'click .imagenAd': function (event,template) {
if(this.idProducto){
Meteor.call("sumarClick", this._id);
Router.go('producto.show', {_id: $(event.currentTarget).data().id});
}
}
});
This is how I render this part of the template:
{{#ionContent class="fondoAzulMarino"}}
<div class="sliderCategorias">
<div class="banners">
{{#each banners}}
<div class="ion-slide" data-id="{{_id}}">
<img src="{{imagen}}" class="imagenAd" data-id="{{idProducto}}">
</div>
{{/each}}
</div>
</div>
{{#ionList}}
{{#each productos}}
{{#ionItem class="avatar lista-productos" path="producto.show"}}
<!-- <a class="item item-avatar item-categoria" data-ion-modal="_producto" data-id="{{_id}}"> -->
<a class="item item-avatar item-categoria">
<img src="{{imagen}}">
<h2>{{nombre}}</h2>
<p>{{formatoDinero precio}} - {{tamano}}</p>
</a>
{{/ionItem}}
{{/each}}
{{/ionList}}
{{/ionContent}}
And because this is a slider I initiate it like this in the ‘Template.categoriasShow.rendered’ function:
this.autorun(function () {
if (!this.subscription.ready()) {
IonLoading.show();
} else {
IonLoading.hide();
$('.sliderCategorias').css('display','block');
$('.banners').on('init afterChange', function(event, slick, currentSlide){
if(slick.$slides){
var idBanner = $(slick.$slides.get(slick.currentSlide)).data('id');
Meteor.call("sumarVista", idBanner);
}
});
$('.banners').slick({
infinite: true,
autoplay: true,
autoplaySpeed: 6000,
arrows: false,
dots: true,
dotsClass: 'slider-pager',
customPaging: function(slider, i) {
return '<span class="slider-pager-page icon ion-record"></span>';
}
});
}
}.bind(this));
And the second error comes when I move from one view to another, I am using Ionic for the UI, and I’m afraid that the error may be related to Meteoric, the package I’m using, but I have no cue for where to start looking for a solution.