Angular 4 - Input / Output Access parent event via Typescript

0

In Angular 4, how do I access the functions of the parent being in the child or the functions of the child being in the parent directly by the Typescript instead of traditionally accessing via tag attribute?     

asked by anonymous 27.12.2017 / 15:31

2 answers

0

One partial solution I found was Create an abstract class! Put in it some abstract methods (as needed and required) and feed the constructor of the abstract class (my needs). That done, the screens (components) that I needed, started to extend this class.

    
27.12.2017 / 20:53
0

Good morning Luiz Felipe, in the Angular can be created a service, once created a service it is an Injectable () and thus it can be passed in the constructors of the new classes in typescript. Using the CLI looks like this:

ng g s shared/servico1 --flat (the flat not to create a folder)

and in your new typescript you can pass it on to the constructor and use it

construtor(private servi:servico1){

}
    
06.09.2018 / 12:56