I have a performance question when you only use AngularJS with pure JavaScript and when you use AngularJS with jQuery.
Example:
app.directive('fitHeight', function($window) {
return {
restrict: 'A',
link: function(s){
s.contentminHeight = $window.innerHeight - 40 + 'px';
var h = $window.innerHeight;
$(window).resize(function() {
if ( h !== $window.innerHeight ) {
h = $window.innerHeight;
s.contentminHeight = ( h - 40 ) + 'px';
s.$apply();
}
});
}
};
});
I saw how the check using AngularJS from $ window resizes is outdated, and the other parameters were to create an interval for the check, I found jquery.resize more acceptable.
or
app.directive('leftmenuDropdown', function() {
return {
restrict: 'C',
link: function(s, e){
e.click(function(){
var m = $(e.parent().find("ul")[0]);
if ( m.hasClass('dd-open') ) { m.removeClass('dd-open') } else { m.addClass('dd-open') }
});
}
};
});
I am searching on google and I realized that .hasClass is faster than pure JavaScript.
About performance, what should I do? To save jQuery using AngularJS or to use only AngularJS with pure JS?
source
share