javascript - Change variable or call funtion from a component from an other component -
this case :
i have component :
@component({ selector: 'home', templateurl: './administration.html', directives: [directivetest] }) export class administration { hello : string; constructor(private http: http) { } ngoninit() { //init stuff here } callme(value) { alert("call you" + this.hello ); } }
and template :
<h3>test administration </h3> <directivetest></directivetest>
this directive :
@component({ selector: 'directivetest', templateurl: './directivetest.html' }) export class directivetest{ klickme() { //call administration function (callme(value)) or change value???????????? } }
is there way change variable or call function "directive" component,
what should :
- first make service ( component without selector)
- put data , related methods in service.
- inject service in both component.
Comments
Post a Comment