Reputation: 131
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?
Upvotes: 0
Views: 46
Reputation: 1298
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:
Upvotes: 1