imsi imsi imsi imsi - 1 year ago 72
AngularJS Question

delete class item dynamiclly

in my ionic project I'm using a toggle the generated html of this toggle is:

<div class="item-toggle toggle-large ng-valid ng-empty item item-toggle" id="dd" ng-class="checkarrivee.ficheDeMission==undefined ? 'item' : ''" ng-model="[]" ng-click="checkarrivee.isMissionSelected(," toggle-class="toggle-positive"><div ng-transclude=""><span class="ng-binding">Ceintures De Sécurités Passagères</span></div><label class="toggle toggle-positive disable-user-behavior"><input type="checkbox" ng-model="[]" class="ng-pristine ng-untouched ng-valid ng-empty"><div class="track"><div class="handle"></div></div></label></div>

is there a way to check item class dynamiclly, because i dont want the item class to appear in my div, i tried to use ng-class but it didnt work, how i can get div without item class???

Answer Source

If your code is added via directive, you can make another directive to fix this issue. Here is an example (untested, but simple). Is checks toggle-class attribute to trigger an item class check:

app.directive('toggleClass', function() {
    return {
        restrict: 'A',
        link: function(scope, element, attrs) {
            if (element.hasClass('item')) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download