F
F
flafy42020-01-14 21:01:11
JavaScript
flafy4, 2020-01-14 21:01:11

How to properly break functionality into files in angular?

Hello! I have several components and in some of them I need to work with an IndexedDB database. How can I correctly move the connection and other functionality (adding, deleting) records to a separate file so that I can import it into the component and already use these functions?
I understand that you can just create a directory, there is a file and write everything there, but is there any standard or special technology (standard) that allows me to do what I want?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Stolyarov, 2020-01-14
@flafy4

Put the logic of work in the service and inject it into the components through the built-in DI mechanism

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question