在 Angularjs 中手动批准时如何更改字段颜色?

How Can I change the filed color while approve manually in Angularjs?

我在我的应用程序中使用 MEAN 堆栈,AngularJS 作为我的前端-end.How 我可以将 green color 更改为 tollerence 159.06 在 table作为手动。 My Plunker

我的Html:-

<td > <p ng-show="{{(mani.invoice_quantity *1) + (mani.conversion_rate *1) | number:2}}>100" style="background-color: red;">{{(mani.invoice_quantity *1) + (mani.conversion_rate *1) | number:2}}</p>

 <p ng-show="{{(mani.invoice_quantity *1) + (mani.conversion_rate *1) | number:2}}<100" style="background-color: Green;">{{(mani.invoice_quantity *1) + (mani.conversion_rate *1) | number:2}}</p></td>

我的数据:-

$scope.sryarndebitnote = [
    {
    "_id": "57ac1b6d82e1c5940ac3c730",
    "user": {
    "_id": "57400c32bd07906c1308e2cf",
    "displayName": "mani selvam"
    },
    "__v": 0,
    "created": "2016-08-11T06:30:05.118Z",
    "shipment_id": "57ac19b982e1c5940ac3c72f",
    "conversion_rate": "62.04",
    "invoice_value_fob_currency": "Rs",
    "invoice_value_fob": "300.231",
    "invoice_quantity_unit": "KG",
    "invoice_quantity": "37",
    "invoice_date": "2016-08-17",
    "supplier_name": "Msd",
    "buyer_name": "Mani selvam .R"
    },

    {
    "_id": "57b5af69df0475401f644b2e",
    "user": {
    "_id": "57400c32bd07906c1308e2cf",
    "displayName": "mani selvam"
    },
    "__v": 0,
    "created": "2016-08-18T12:51:53.671Z",
    "shipment_id": "57b5af5bdf0475401f644b2d",
    "conversion_rate": "62.06",
    "exclusive": true,
    "invoice_value_fob": "400.343",
    "invoice_quantity": "97",
    "supplier_name": "Msd",
    "buyer_name": "Mani selvam .R"
    },]

首先,我建议您使用 ngStyle 而不是 ngShow。如果您想手动更改它,您可以添加一个按钮并添加更改

的值
<td>
    <p ng-style="{'background-color': (mani.invoice_quantity *1) + (mani.conversion_rate *1) > 100 || mani.approved ? 'green' : 'red'}">{{(mani.invoice_quantity *1) + (mani.conversion_rate *1) | number:2}}</p>
    <button ng-click="mani.approved = true">Approve</button>
</td>