How remove first empty element in dropdown in AngularJS1.4.3

Hello, currently I have some count of legacy projects on the support and they are has been created with AngularJS 1.4.3. 

This is framework has features what first element element in dropdown will be empty.

By design it's must be element with label as 'Select from dropdown'.


The original code:

<select ng-model="feed.config">
    <option ng-repeat="template in configs" ng-selected="$first">{{}}</option>

Because this is versions is intermediate, solutions as 

<option value="" style="display: none"></option>


<option value="" ng-if = "false"></option>


<option value="" ng-show = "false"></option>

Some cituation with all solutions from this is link:

Not will be work. Modificated code:

Worked solution for this is version:

<select ng-model="" convert-to-number>
  <option value="0">Zero</option>
  <option value="1">One</option>
  <option value="2">Two</option>
{{ model }}

angular.module('nonStringSelect', [])
.run(function($rootScope) {
  $rootScope.model = { id: 2 };
.directive('convertToNumber', function() {
  return {
    require: 'ngModel',
    link: function(scope, element, attrs, ngModel) {
      ngModel.$parsers.push(function(val) {
        return parseInt(val, 10);
      ngModel.$formatters.push(function(val) {
        return '' + val;


ngSelected :

$first :

Examples with some problem:

Docs for version:


Популярные сообщения из этого блога

Вопросы с собеседования С++ (2018)