How do I use ".then function" after I Customized my UIKit Modal while using in Angular Service

64 Views Asked by At

So I customized my code as per my need and now i couldn't use "then(function(){}" like before ,So below is the code i wrote to customize UIKit Modal

So Is there anyway i could customize UiKit modal and use "then" function

export class ToasterConfirmService{ constructor() {}

confirm(msg: string): void{
    localStorage.setItem('YesNo','open');

    var modal=uikit.modal.confirm(msg).dialog;

    if(modal && modal.$el)
    {
        if(modal.$el.firstElementChild)
        {
            modal.$el.firstElementChild.classList.add(centerAlign);
            modal.$el.firstElementChild.style.fontSize = mediumFontSize;
            modal.$el.firstElementChild.style.background = notificationsBackgroundColorCode;
            modal.$el.firstElementChild.style.color = styleWhiteColor;
        }

        if(modal.$el.getElementsByClassName(UIkitModalFooter) && modal.$el.getElementsByClassName(UIkitModalFooter).length \> 0)
        {
            modal.$el.getElementsByClassName(UIkitModalFooter)\[0\].classList.remove(textAlignRight);
            modal.$el.getElementsByClassName(UIkitModalFooter)\[0\].classList.add(textAlignCenter);
            modal.$el.getElementsByClassName(UIkitModalFooter)\[0\].style.background = notificationsBackgroundColorCode;
            modal.$el.getElementsByClassName(UIkitModalFooter)\[0\].style.color = styleWhiteColor;
        }
        if(modal.$el.getElementsByClassName(UIkitModalClose) && modal.$el.getElementsByClassName(UIkitModalClose).length \> 0)
        {
            modal.$el.getElementsByClassName(UIkitModalClose)\[0\].style.fontSize = mediumFontSize;
            modal.$el.getElementsByClassName(UIkitModalClose)\[0\].style.background = styleWhiteColor;
            modal.$el.getElementsByClassName(UIkitModalClose)\[0\].style.color = styleBlackColor;
            modal.$el.getElementsByClassName(UIkitModalClose)\[0\].classList.add(centerAlign);
            modal.$el.getElementsByClassName(UIkitModalClose)\[0\].innerHTML='No';
        }
        if(modal.$el.getElementsByClassName(UIKitConfirmOK) && modal.$el.getElementsByClassName(UIKitConfirmOK).length \> 0)
        {
            modal.$el.getElementsByClassName(UIKitConfirmOK)\[0\].style.fontSize = mediumFontSize;
            modal.$el.getElementsByClassName(UIKitConfirmOK)\[0\].style.background = styleWhiteColor;
            modal.$el.getElementsByClassName(UIKitConfirmOK)\[0\].style.color = styleBlackColor;
            modal.$el.getElementsByClassName(UIKitConfirmOK)\[0\].classList.add(centerAlign);
            modal.$el.getElementsByClassName(UIKitConfirmOK)\[0\].innerHTML='Yes';
        }         
        
    }
    
    
     

    
}

}

0

There are 0 best solutions below