Thursday, September 28, 2017

angularjs scope variables are not working but works on second click

Hi I am developing web application in angularjs. I have implemented print functionality. I am binding values to view using scope variables. When i click first time on print my values are not binding. When i click second time all my values will bind. Below is the print functionality.

 $scope.Print = function () {
                if ($scope.period == null) {
                    toastr.error($filter('translate')('Please select Year.'));
                }
                else {
                $scope.vehiclepriceprint = $cookieStore.get("carpriceprint");
                $scope.downpaymentprint = $cookieStore.get("downpayment");
      }

First time also i will be having values in cookie but not binding to view. Whenever i click second time on print button everything will be working
Below is the print button.

  <input type="button" value="Print" class="blue-button"  ng-click="Print()" id="btnPrint">

Below is the html code of print.

   <span id="lblDownPayment"></span>
   <span id="lblFinancialAmount"></span>

May i know what is the issue i am facing here? Any help would be appreciated. Thank you.

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/09/28/angularjs-scope-variables-are-not-working-but-works-on-second-click/
via @lzomedia #developer #freelance #web

No comments:

Post a Comment