0

How do I add a file only with functions that i will use several times in the angular js 2 ?

The created file has to be in ts or may be in js?

1 Answer 1

1

You should create a service class and inject it into the components that will use it's functions.

Angular has a great tutorial on implementing services:

Angular Service Tutorial

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, hadn't thought in this form

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.