Wrapping 3rd party libraries can be a challenge when dealing with Angular directives. The four steps laid out in this article should help.
Angular
A collection of 3 posts
Your SPA is not the Front-end
We often consider the location of execution as defining an architectural boundary. We think that code that runs in the browser is necessarily GUI code. That’s not quite true, however. Business code can run in the browser, and formatting code run on the server.
Dependency Inversion in Angular
Angular has a powerful dependency injection system. Learn how to use it so that your code complies with the Dependency Inversion Principle.