V
V
vasIvas2015-07-31 23:00:02
Angular
vasIvas, 2015-07-31 23:00:02

Is it necessary to expand the directive when it is necessary to pre-calculate its parameters?

Here's the thing. There is a module angular-vidoe-bg which has a directive that expects ratio in the parameters, which is responsible for the format-scale of the video. And so it turns out that the best proportions can be achieved by calculating this ratio yourself.
And this means that somewhere you need to write code that recognizes the screen sizes and, after calculations, transfers these values ​​to the directive.
But what is the best way to do this? Several options come to mind. At initialization, but this is at the configuration level of the application itself, which is already wrong.
There is also an idea to expand the directive with a directive. But I don't quite understand how to do it. I found an article on Habré, but there the author shows how to extend the ideal native directive.
Here.. What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-07-31
@vasIvas

hmm... decorator? You can make a directive inside which other directives are used. And in it to encapsulate all the logic for calculating parameters relative to the viewport or container.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question