Skip to content

Fcsa-number is not working properly with ng-submit directive of angular #37

@khanstudio-github

Description

@khanstudio-github

I'm submitting a ...

[x] bug report

Current behavior
Fcssa-number is not working properly with ng-submit directive. Whenever I append or prepend anything using fcsa-number and submit the form it turns that field red and stores value in model as 'undefined'. It only shows this error on append or prepend without them it works fine.

Also if I remove ng-submit and use ng-click on submit button to call saveForm() function, it works fine while using prepend/append as well. It only shows error when using ng-submit directive

This is my code from a View.html

<form id="frmCostAndApproval" name="frmCostAndApproval" ng-submit=saveForm() novalidation>
  <div class="form-group">
      <label>Workup Sum Approved:</label>
      <input type="text" fcsa-number="{ prepend: '$' , preventInvalidInput: true }" class="form-control" name="WorkupSumApproved" ng-model="costAndApprovals.WorkupSumApproved" autocomplete="off" />
  </div>
  <div class="form-group">
       <label>AG2 Total Costs Approved:</label>
       <input type="text" fcsa-number="{ preventInvalidInput: true }" class="form-control" name="AG2TotalCostApproved" ng-model="costAndApprovals.AG2TotalCostApproved" autocomplete="off" />
  </div>
<button type="submit" class="btn btn-primary" ng-disabled="frmCostAndApproval.$pristine">
                        Submit
</button>
</form>

This is my code from a angular controller file ctrl-Cost&Approval.js

$scope.saveForm = function () {
            $scope.isProcessing = true;
            var item = angular.copy($scope.costAndApprovals);
            console.log(item);
}

This is my console window output

object
 WorkupSumApproved: undefined,
 AG2TotalCostApproved: 545452

Please guide me what the issue is and provide your help to the earliest. Looking forward for a positive response. Thank you.

Expected/desired behavior
The fields with prepend/append should not be undefined when form is submitted using ng-submit directive of AngularJs

About my environment:

  • AngularJS version: v1.4.1
  • angular-fcsa-number version: v1.5.3
  • Browser: [Chrome 51.0.2704.103 m |]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions