2017-11-02 9 views
2

私は単純な計算ロジックを持っていますが、計算しようとするとNaNと表示されます。あなたがそうでなければ、その空の文字列、当初だけでなく数量の値を持っている必要がありAngular js CalculationでNaNを削除するには?

<!DOCTYPE html> 
 
<html> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> 
 
<body> 
 

 
<p>Change the value of the input field:</p> 
 

 
    <div ng-app="" ng-init="okpcs=10"> 
 
    <p>Qty for Bundle Packing :- <input type="number" ng-model="qty"></p> 
 
    <h3> Bundles :- {{okpcs/qty}}</h3> 
 
    </div> 
 

 

 
</body> 
 
</html>

答えて

2

くれ空白表示のための適切なソリューションが提供してNAN

<div ng-app="" ng-init="okpcs=10;qty=10"> 
を返してください。

<html> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> 
 
<body> 
 

 
<p>Change the value of the input field:</p> 
 

 
    <div ng-app="" ng-init="okpcs=10;qty=10"> 
 
    <p>Qty for Bundle Packing :- <input type="number" ng-model="qty"></p> 
 
    <h3> Bundles : {{okpcs/qty}}</h3> 
 
    </div> 
 

 

 
</body> 
 
</html>

関連する問題