[Solved] Format a number xxxx to be xx/xx in AngularJS?


Your question is more of a javascript question than angularjs one unless you are talking about using a filter to do it. You could use that code to do it if your number will always have 4 digits:

app.filter('addDelimiter', function () {
  return function (number) {
    var firstPart = number.slice(0,2);
    var lastPart = number.slice(2,4);
    var delimeter = "https://stackoverflow.com/";
    var result = firstPart +delimeter+lastPart;
    return result
  };
});

With that filter you would be able to use it like that

{{ number | addDelimiter}}

and it would return xx/xx

2

solved Format a number xxxx to be xx/xx in AngularJS?