[英]How to call a function in one angular component from another component(different .ts file)
File1.ts文件1.ts
export class1(){
dummy(a,b){
....
}
}
File2.ts文件2.ts
export class2(){
a: string = "scjhb"
b: string ="mn hbh"
//From here,I want to call dummy pass these parameters and call dummy function from file1.ts.How to do?
dummy(a,b); //I want to call dummmy(a,b)
}
i tried the below thing in File2.ts,but it's not working.
@ViewChild(class1, { static: false }) Classvar: class1; @ViewChild(class1, { static: false }) Classvar: class1; this.Classvar.dummy(a,b)
this.Classvar.dummy(a,b)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.