I'm having trouble with this. I will be getting an object which will have
an array of CSS file names which I will have to load for a directive. The
number of CSS files can vary.
I'd like to inject link rels in to the head of the document.
How should I approach this? Should I be using the compile or link attribute
of a directive, or should I be doing something else entirely?
I tried using the compile attribute, and tried appending link rels inside
of a forEach, but for whatever reason it doesn't seem to want to do one
link rel per array item, it instead concatenates all items to one link rel
tag which of course doesn't work.
For example,
['a.css','b.css','c.css'].forEach(s){
tElement.append('<link href="' + s + '" rel="stylesheet" />');
}
Actually produces:
<link href="a.css,b.css,c.css" rel="stylesheet" />
Instead of three separate link rels for each css in the array. Which of
course 404s out.
Am I missing something here and or doing this completely wrong? I'm pretty
much a beginner here.
Advice much appreciated!
Thanks,
pv
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.