<div class="odiintexpand" ng-repeat="details in odata_odi.PRODUCT">
<div class="clm1" id="product1">{{details.COMPONENT}}</div>
<div class="clm2" ng-show="cp.getColour('odiintexpand','clm2','{{details.ASKERNEL}}')">{{details.ASKERNEL}}</div>
<div class="clm3" ng-show="cp.getColour('odiintexpand','clm3','{{details.SOA}}')">{{details.SOA}}</div>
<div class="clm4" ng-show="cp.getColour('odiintexpand','clm4','{{details.ODIINT}}')">{{details.ODIINT}}</div>
<div class="clm5" ng-show="cp.getColour('odiintexpand','clm5','{{details.ASCORE_LINUX}}')">{{details.ASCORE_LINUX}}</div>
<div class="clm6" ng-show="cp.getColour('odiintexpand','clm6','{{details.WEBCENTER}}')">{{details.WEBCENTER}}</div>
<div class="clm7" ng-show="cp.getColour('odiintexpand','clm7','{{details.BI}}')">{{details.BI}}</div>
<div class="clm8" ng-show="cp.getColour('odiintexpand','clm8','{{details.FMWTOOLS}}')">{{details.FMWTOOLS}}</div>
</div>
我在ng-repeat循环中调用一个函数。该功能正在设置&#34; id&#34;该特定类的属性。这是功能。
this.getColour = function(a, b, c) {
var return_value = findColor(c);
if (return_value.indexOf("1F0101") >= 0) {
$("." + a + " ." + b).attr('id', 'v2');
} else if (return_value.indexOf("013D02") >= 0) {
$("." + a + " ." + b).attr('id', 'v3');
} else if (return_value.indexOf("575701") >= 0) {
$("." + a + " ." + b).attr('id', 'v4');
} else {
$("." + a + " ." + b).html("N/A");
$("." + a + " ." + b).attr('id', 'v1');
}
return 1;
};
但结果并不正确。它填充任意id。
我的代码中的逻辑是: - 根据html文本(例如{{details.SOA}}),我正在更改该特定类的id。动态地它没有发生。
感谢您的帮助!
这里是数据样本`PRODUCT:[ { 组件:&#34; test1&#34;,
SOA:&#34; 140423.0745&#34;, FMWTOOLS:&#34; 140423.0745&#34; }, { 组件:&#34; test2&#34;,
SOA:&#34; 12.2.1.0.0-150420.1742&#34;, FMWTOOLS:&#34; 12.2.1.0.0-150420.1742&#34; }, { 组件:&#34; test3&#34;,
SOA:&#34; 12.2.1.0.0-150423.0100.0339&#34;, FMWTOOLS:&#34; 12.2.1.0.0-150423.0100.0339&#34; }, { 组件:&#34; test4&#34;,
SOA:&#34; 20140509.1601&#34;, FMWTOOLS:&#34; 20140509.1601&#34; }, { 组件:&#34; test5&#34;,
SOA:&#34; 12.1.4-150422.2254.0878&#34;, ODIINT:&#34; 12.1.4-150422.2254.0878&#34;, WEBCENTER:&#34; 12.1.4-150422.2254.0878&#34;, FMWTOOLS:&#34; 12.1.4-150421.2315.0875&#34; }, { 组件:&#34; test6&#34;,
SOA:&#34; 12.2.1.0.0-150423.0357&#34;, ODIINT:&#34; 12.2.1.0.0-150423.0357&#34;, FMWTOOLS:&#34; 12.2.1.0.0-150422.0715&#34; } ]`
这里是id v1的css。
#v1 {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #99CCFF; //
grey-moz-radial-gradient background-image: -moz-radial-gradient(center, circle farthest-side, #EDF6FF 0%, #C2E0FF
100%);
background-image: -webkit-radial-gradient(center, circle farthest-side, #EDF6FF 0%,
#C2E0FF 100%);
/* box-shadow: 1px 1px 1px #888888; */
border: 1px solid #ffffff;
}