samedi 19 novembre 2016

I wrote an if condition inside angularjs controller, not working properly

I wrote this if statement by myself to differentiate USD and LKR, the values are not coming properly. Is this if condition correct?

$scope.$watch('currencyVal', function () {
                            if ($scope.currencyVal === "USD") {
                                 if ($scope.shipping_method === "pronto") {
                                     if($scope.weight >= 1){                                    
                                         $scope.output = '101';
                                     }
                                     else 
                                     {                        
                                      $scope.output = '102';
                                     }
                                 }else
                                 {                      
                                     $scope.output = '103';
                                 }

                            } else if ($scope.currencyVal !== "USD") {

                                if ($scope.shipping_method === "pronto") {
                                     if($scope.weight >= 1){                                      
                                        $scope.output = '104';
                                     }
                                     else 
                                     {
                                        $scope.output = '105';
                                     }
                                }
                                else{
                                            $scope.output = '106';
                                }
                            }

                        });

Aucun commentaire:

Enregistrer un commentaire