1

I have problem with zeros like above :

in html I have :

<div class="form-group form-group-default">
   <label>Numéro</label>
   <input class="form-control" style="margin-bottom: 11px;" placeholder="(+33)57 24 05 99" ng-model="produit.telephone">
</div>

the model is:

telephone: {type: Number, default: null}

when I put a number which has zero on the left, it will not be considered.

for instance when I put 0160206576, it will be saved as 160206576

1
  • Numbers simply can't start with a zero, if you need a zero first then it must be a string. Commented Feb 10, 2017 at 15:31

2 Answers 2

3

If it has zeros in the front, it must be stored as a string, like this:

 app.controller("main",function($scope){
   $scope.produit.telephone = "0160206576";

  });
Sign up to request clarification or add additional context in comments.

Comments

0

Change the type number, for allowing preloading 0, to String

telephone: {type: String, default: null}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.