I kind of got this working in angular 1.5 using a nifty custom directive (see example below in typescript).
Since it appears there is no way to programmatically select the entire value while the input type="number", the strategy here is to temporarily change the input type from number to text while editing the value, then change it back to the original type on blur.
This results in behavior that differs slightly from the native behavior in that it will actually allow you to type in "invalid" data into the field. However, on blur, all of the browser's native number validation logic will kick in and prevent any invalid data from being submitted. I'm sure there's some other gotchas but it's works well enough in Chrome and FireFox for us so I thought I'd share.
/// Selects the entire input value on mouse click.
/// Works with number and email input types.
export class SelectOnClick implements ng.IDirective {
require = 'ngModel';
restrict = 'A';
private ogType: any
constructor(private $window: ng.IWindowService) { }
link = (scope: ng.IScope, element: any) => {
element.on('click', () => {
if (!this.$window.getSelection().toString()) {
this.ogType = element[0].type;
element[0].type = 'text';
element[0].setSelectionRange(0, element[0].value.length);
}
})
element.on('blur', () => {
element[0].type = this.ogType;
})
}
static factory(): ng.IDirectiveFactory {
var directive = ($window: ng.IWindowService) => new SelectOnClick($window);
directive['$inject'] = ['$window'];
return directive;
}
}