ng-style

Change style of pseudo elements in angular2

北城以北 提交于 2019-11-26 16:25:19
问题 Is it possible to change style of pseudo elements using [style] or [ngStyle] in angular2? in order to get a blur effect on a div acts like an overlay, and I should set up background-image on pseudo element. I tried something like <div class="blur" [style.before.backgroundImage]="'url('+ featuredImage[i] + ' )'"> it didn't work. I also tried this <div class="blur" [ngStyle]="'{:before{ background-image:url('+ featuredImage[i] + ' )}}'"> 回答1: No it's not possible. It is actually not an Angular

Apply CSS style attribute dynamically in Angular JS

我与影子孤独终老i 提交于 2019-11-26 05:22:54
问题 This should be a simple problem, but I can\'t seem to find a solution. I have the following markup: <div style=\"width:20px; height:20px; margin-top:10px; border:solid 1px black; background-color:#ff0000;\"></div> I need the background color to be bound to the scope, so I tried this: <div style=\"{width:20px; height:20px; margin-top:10px; border:solid 1px black; background-color:{{data.backgroundCol}};}\"></div> That didn\'t work, so I did some research and found ng-style , but that didn\'t