Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何区分Rs和%值?_Angularjs_Logic_Shopping Cart_Ng Repeat - Fatal编程技术网

Angularjs 如何区分Rs和%值?

Angularjs 如何区分Rs和%值?,angularjs,logic,shopping-cart,ng-repeat,Angularjs,Logic,Shopping Cart,Ng Repeat,在我的购物车应用程序中,我从服务器获得价格和百分比的优惠。 我需要用卢比和%区分价格值和百分比值 以下是我在控制器中的代码: if(result.type == 'Price'){ $scope.invoice_amt = $scope.invoice_amt - result.offer ;

在我的购物车应用程序中,我从服务器获得价格和百分比的优惠。 我需要用卢比和%区分价格值和百分比值

以下是我在控制器中的代码:

if(result.type == 'Price'){                                     
                                    $scope.invoice_amt = $scope.invoice_amt - result.offer ;                                                                                    
                                    } 
                                    else if(result.type == 'Percentage'){                                     
                                    $scope.invoice_amt = $scope.invoice_amt * result.offer/100;                                                                                    
                                    } 
我在HTML中得到的值是{{invoice\u amt}
如何以卢比和百分比显示报价。

您必须使用货币过滤器,下面的示例将以卢比打印(₹ )

   Invoice Price<span>{{invoice_amt | currency:"&#8377;"}}</span>
发票价格{{发票金额}货币:₹;}
下面的链接中提到了相关的百分比

在您的作用域中再使用一个变量来检查类型,并在此基础上编写逻辑。请参阅相关文档