© Matthew Duffield 2018
Matthew DuffieldPractical App Development with Aurelia https://doi.org/10.1007/978-1-4842-3402-0_6

6. Services

Matthew Duffield1 
(1)
West Linn, Oregon, USA
 

As your applications become more and more complex, you will find yourself refactoring your code and pulling out redundancies. By using dependency injection (DI), it is easy to create a custom class that corresponds to a set of functions that make it easy to do a specific operation. You will be able to inject your services as singletons or as new instances. This gives you plenty of flexibility to handle all sorts of scenarios in your application.

Creating a service is as simple as exporting a class. What you do in the service depends entirely on what type of functionality ...

Get Practical App Development with Aurelia: Leverage the Power of Aurelia to Build Personal and Business Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.