I have a simple text input field in my angular app which is prefilled with a default value. I want to preselect the text on page load.
Input field:
<input type="text" ng-model="city" class="form-control" select-on-load />
Directive:
weatherApp.directive('selectOnLoad', function () {
// Linker function
return function (scope, element, attrs) {
element.bind('load', function () {
this.select();
});
};
});
But nothing happens.