मैं अपने ऐप से jquery को हटाना चाहता हूं .. लेकिन मुझे angularjs में $ .each के लिए विकल्प चाहिए ... मैं डोम तत्वों के चारों ओर कैसे लूप कर सकता हूं ?? यहाँ मैं अपने कोड को शामिल किया है .. मैंangularjs में प्रत्येक jquery के लिए विकल्प क्या है?
app.directive('activeu', function($location) {
return function ($scope, element, attrs) {
var menuMain = $scope.$parent.menuMain;
var fullpath = $location.path().split('/');
var current = fullpath[2];
setTimeout(function() {
$(".nav li a").each(function() {
if ($(this).attr('href') == '#!/page/' + current) {
$(this).parent().addClass('active');
$(this).closest('li.root-li').addClass('active');
if ($(this).closest('li.parent').length > 0) {
$(this).closest('li.parent').addClass('active');
}
}
});
$(".nav li a").on('click', function() {
current = $(this).attr('href');
$("#pages-menu .navigation li").each(function() {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
}
});
$(".nav li a").each(function() {
if ($(this).attr('href') == current) {
$(this).parent().addClass('active');
$(this).closest('li.root-li').addClass('active');
if ($(this).closest('li.parent').length > 0) {
$(this).closest('li.parent').addClass('active');
}
}
});
});
}, 500);
};
});
यह मुझे var htm = "Login" जैसा दे रहा है .. मैं इसे htm.href की तरह एक्सेस कर सकता हूं .. लेकिन इसके बजाय अगर मैं इसे htm.attr ('href') की तरह एक्सेस करना चाहता हूं, किस तरह क्या इसे मै कर सकता हूँ?? – Amb
@amss मुझे लगता है कि आपको कुछ और विवरण साझा करने की आवश्यकता है कि आप किस प्रकार का डेटा पुन: प्रयास करने की कोशिश कर रहे हैं और वांछित आउटपुट –
मैंने अपना प्रश्न संपादित किया है ... मैं प्रत्येक को jquery को कोणीय में बदलना चाहता हूं। इसके लिए – Amb