Search Posts

Category: angular2-directives

How to use value of click function of addEventListener in another function?

I want to use value of a click function in another function using angular 2. My code is written below : optionFn(id){ let root = this.viewCtrl.instance.navCtrl._app._appRoot; // console.log(root); document.addEventListener(‘click’, function (event) { let btn = document.querySelector(‘.remove-ok .alert-button-default:nth-child(2)’); let target =; if (btn && target.className == ‘alert-radio-label’) { let view = root._overlayPortal._views[0]; let inputs = view.instance.d.inputs; console.log(“inputs” + JSON.stringify(inputs)); for(let input of inputs) { let input = inputs_1[_i]; if (input.checked) { // this.optionEvent1 =input.value; view.instance.d.buttons[1].handler([input.value]); […]

Angular 2, Using Jquery to Manipulate Bootstrap

I’m pretty new with NG2, and I’m trying to add Slide Up/Down effects do default Bootstrap 4 Dropdown component. The Bootstrap dropdown component has 2 Jquery Listeners $(el).on(‘’) and $(el).on(‘’). So I created a directive to add this effects: import { Directive, OnInit, AfterViewChecked, ElementRef, Input } from ‘@angular/core’; import * as $ from ‘jquery’; @Directive({ selector: ‘[appDropDownAnimate]’ }) export class DropDownAnimateDirective implements AfterViewChecked { @Input() appDropDownAnimate: boolean; private el = this.ElementRef.nativeElement; constructor(private ElementRef: ElementRef) […]