在 AngularJS 中绘制彩色点

Draw colored dots in AngularJS

我在 angularJS 应用中看到了这个:

也许他在画边界??任何想法我怎么能正确地做到这一点? 颜色应该是可变的。

我做了一个plunker可以用ngStyle改变点的颜色,请看一下。

使用 ngStyle,您还可以更改控制器内的背景颜色。

HTML代码:

<body ng-app="">
  <input type="button" value="change color to blue" ng-click="myStyle={'background-color':'blue'}">
  <input type="button" value="change color to red" ng-click="myStyle={'background-color':'red'}">
  <div class="circle" ng-style="myStyle"></div>
</body>

CSS代码:

.circle {
  height: 20px;
  width: 20px;
  background-color: red;
  border-radius: 10px;
}