Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

set default value in dropdown angular 7

Set validation.min with required as well like below one.

supplierId: ["", [Validators.required, Validators.min(1)]]
supplierId is always greater zero so min(1) works for you.
Comment

Setting the default value in the drop down list in AngularJS

EmployeeStatusChangeRoutingInput: {
    Action: 'value3'
}

ng-options="option.Name as option.Value for option in Data.Actions"
angular.module('myApp', [])
  .controller('myCtrl', ['$scope', function($scope) {
    $scope.Data = {
      Actions: [{
        Value: 'test1',
        Name: 'value1'
      }, {
        Value: 'test2',
        Name: 'value2'
      }, {
        Value: 'test3',
        Name: 'value3'
      }],
      EmployeeStatusChangeRoutingInput: {
        Action: 'value3'
      }
    }

  }])

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
  
  <div class="dropdownIcon">
    <select name="actions" id="actions" ng-options="option.Name as option.Value for option in Data.Actions" ng-focus="ActionsLabel = true" ng-blur="ActionsLabel = false;" ng-model="Data.EmployeeStatusChangeRoutingInput.Action"></select>
  </div>
</div>
Comment

set default value in dynamic dropdown angularjs

$http.post('commandCenter.aspx/allCustomer', {}).then(
                    function onSuccess(response) {
                        $scope.customers = JSON.parse(response.data.d);
                        if ($scope.customers.length === 1) {
                          $scope.relatedTo = $scope.customers[0].CUSTCODE;
                        }
                        console.log($scope.customers); },
                    function onError(response) {
                        console.log('error !!! ');
                    });
Comment

PREVIOUS NEXT
Code Example
:: How to hide div based on select the dropdown in angular js 
::  
::  
::  
Javascript ::  
Javascript :: javascript unique grouped arrays 
Javascript :: react-native installation error with npx react-native 
Javascript ::  
:: js generate pnh 
:: assignment is to create a small website using NestJS in the backend and basic HTML CSS in the frontend 
::  
Javascript ::  
Javascript ::  
Javascript :: open div with onClick element position 
:: Odoo Javascript Modules 
Javascript :: function x(a) vs function x(...a) the difference 
Javascript ::  
Javascript ::  
Javascript :: Inside Vs Static Methods 
:: javascript reverse string short hand 
Javascript :: open bootstrap modal from another modal 
:: Use Dynamic Scales 
Javascript ::  
Javascript ::  
:: next.js api typescript 
Javascript ::  
:: file path to blob javascript 
Javascript :: use strict print this 
:: jquery equivalent of number_format( 
Javascript :: var vs let javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =