You should write a directive with a parser and formatter. The parser function should convert from the displayed value with spaces to a number, and the formatter function converts the number to the displayed text.
Something like:
angular.module('app').directive('formattedNumber', formattedNumber);
function formattedNumber() {
var directive = {
restrict: 'A',
require 'ngModel',
link: link
};
return directive;
function link(scope, element, attrs, ngModelController) {
ngModelController.$parsers.push(parseNumber);
ngModelController.$formatters.push(formatNumber);
}
function parseNumber(viewValue) {
// convert text with spaces to number and return it.
}
function formatNumber(modelValue) {
// convert numeric modelValue to formatted text and return it.
}
}
Then just:
<input type="number" name="price" ng-model="ctrl.form.price"
formatted-number required>