You're better off using Angular2 style:
<div *ngFor="let color of colors"
class="color-swatch"
[ngStyle]="{'background-color': color}"
</div>
On Fri, Jul 8, 2016 at 5:00 PM, 'Forrester Cole' via AngularJS <
[email protected]> wrote:
> Hi all,
> I'm trying to set the background-color style of an element using a
> template. I have template html code that looks like:
>
> <div class="picker-flex-box">
> <div *ngFor="let color of colors"
> class="color-swatch"
> style="background-color: {{color}}"
> </div>
> </div>
>
> where colors is a list of color strings in the hex RGB format. Running the
> app, I get a lot of warnings like:
>
> WARNING: sanitizing unsafe style value background-color: #7C4835 (see
> http://g.co/ng/security#xss).
>
> is this actually an unsafe string? If so, what should I do differently to
> set the color of this element? I've tried using the rgb() format and got
> the same results.
>
> Thanks a lot,
>
> Forrester
>
> --
> 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 https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH <http://ehr.meditech.com>
781-774-2293
--
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.