0
At Angular 4, how do I access the functions of the parent being in the child or the functions of the child being in the direct parent by Typescript instead of traditionally accessing via tag attribute?
0
At Angular 4, how do I access the functions of the parent being in the child or the functions of the child being in the direct parent by Typescript instead of traditionally accessing via tag attribute?
0
Good morning Luiz Felipe, in Angular can be created a service, so created a service he is an Injectable() and so it can be passed in the constructs of the new classes in typescript. Using the CLI gets like this:
ng g s shared/servico1 --flat
( flat to not create a folder )
and in your new typescript you can pass it in the constructor and use it
construtor(private servi:servico1){
}
0
A partial solution I found was Create an abstract class! Put in it some abstract methods (as long as necessary and mandatory) and feed the constructor of the abstract class (my needs). Having done this, the screens (components) I needed, began to extend this class.
Browser other questions tagged javascript typescript angular
You are not signed in. Login or sign up in order to post.
I don’t know any other way, but I might be wrong so I’ll just leave you one comment. If I explain better what I want, maybe the solution is different, because I don’t see what can’t be done with
Input
orOutput
that needs another solution.– Filipe Moraes