Answer the question
In order to leave comments, you need to log in
How do you include images as part of AngularJS directives?
Actually, small images via Data URL, yes. But now I have a directive in my work, in which many elements of the user UI are implemented by raster backgrounds. I don’t want to shove almost half a meter into the Data URL, there are articles that significantly suffer performance during the initial display (base64 decoding).
And, an essential detail: the assembly is in progress at a gallop. All js sources (controllers, directives, etc.) are merged into one js file.
Similarly, all css directives are glued to the main css file.
What is the best way to deal with images in this case in order to automate as flexibly as possible, without unnecessary prescribing paths.
By the way, the same question is relevant if you use templateURL in directives, but for now I just bypass the line in js.
Answer the question
In order to leave comments, you need to log in
IMHO: the paths of the main folders must be written in constants, respectively, on the output, either a helper or a constant + path to the file, or in less sass it is a path variable to the folder with backgrounds, as in your case.
DataUri is only for interface elements (and preferably in a vector), no need to shove everything there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question