动态地改变与AngularJS CSS类的属性 [英] Dynamically change a css class' properties with AngularJS

查看:187
本文介绍了动态地改变与AngularJS CSS类的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有搜索,但没有发现有关以下任何回答:

I've search but not found any answer about the following :

我喜欢长相举实例的方式

I like the way examples by bootstrap looks

<css>
.bs-docs-example {
  background-color: #FFFFFF;
  border: 1px solid #DDDDDD;
  border-radius: 4px 4px 4px 4px;
  ...
}
.bs-docs-example:after {
  background-color: #F5F5F5;
  border: 1px solid #DDDDDD;
  border-radius: 4px 0 4px 0;
  color: #9DA0A4;
  content: "Title";
  ...
}

但我需要更改的 .BS-文档,例如的内容的:在的动态
就象这样:

But I need to change the content in the .bs-docs-example:after dynamically as this :

<html>
<div class="bs-docs-example" ng-style="content:'{{ title }}';"
     ng-repeat="title in titles">

你觉得这是一件可能吗?怎么样?

Do you think this is something possible ? And how ?

由于事先通过

推荐答案

其实我发现,不涉及一个解决方案:后(我在CSS是如此糟糕,我还没有想过这个问题迟早...)
我也学习CSS位。这里所说:

Actually I found a solution that doesn't involve :after (I'm so bad in CSS I haven't thought about it sooner ...) I also learn a bit in CSS. Here goes :

<css>
.bs-docs-example {
   background-color: #FFFFFF;
   border: 1px solid #DDDDDD;
   border-radius: 4px 4px 4px 4px;
   ...
}
.bs-docs-example-title {
  background-color: #F5F5F5;
  border: 1px solid #DDDDDD;
  border-radius: 4px 0 4px 0;
  color: #9DA0A4;
  content: "Title";
  ...
}

和使用这样的:

<html>
<div class="bs-docs-example" ng-repeat="title in titles">
<span class="bs-docs-example-title">{{ title }}</span>
</div>

我希望有所帮助。

I hoped that helps.

这篇关于动态地改变与AngularJS CSS类的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆