Answer the question
In order to leave comments, you need to log in
How to call a component function from another?
Hello, I have one problem - I don't know how to call the component's function, just like I call the $('#modal_ask').modal();
Here is the component:
import {Component, OnInit, Input, OnChanges, SimpleChanges} from '@angular/core';
declare var $: any;
@Component({
selector: 'app-terminal-modal',
templateUrl: './terminal-modal.component.html',
styleUrls: ['./terminal-modal.component.css']
})
export class TerminalModalComponent implements OnChanges, OnInit {
@Input() model: any;
@Input() wtf: any;
id: any = '#profile';
constructor() {
}
ngOnInit() {
console.log(this.model);
}
modalReviewsText() {
$('#modal_ask').modal();
}
ngOnChanges(changes: SimpleChanges) {
console.log(this.model);
if (this.model)
this.showModal();
}
showModal() {
console.log(this.id);
$(this.id).modal();
}
hideModal() {
console.log(this.id);
$(this.id).modal('hide');
}
}
<app-terminal-modal
[wtf]="time"
[model]="parking"
></app-terminal-modal>
showModal() {
console.log(this.id);
$(this.id).modal();
}
directly as a function?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question