w3tweaks.com
  • Effects
    • Scroll Effects
    • Text Effects
    • Shadow
  • Essentials
    • Arrows
    • Buttons
    • Background Patterns
    • Border Examples
    • Cards
    • Color Palettes
    • Dividers
    • Link styles
    • Loaders
    • Modal Windows
    • Notifications
    • Progress bar
    • Quote styles
    • Spinner
    • Tooltips
  • Media
    • Calendars
    • Carousels
    • Clocks
    • Gallery
    • Music Players
    • Sliders
    • Slideshows
    • Tables
    • Thumbnails
  • Navigation
  • Inputs
    • Range Sliders
    • Checkboxes
    • Toggle Switches
  • Scripts
    • Angularjs
    • Backbone.js
    • bootstrap
    • jQuery
    • ReactJs
    • JavaScript
    • Syntax Highlighters
    • tryit editor
    • PHP
  • API’s
    • Facebook
    • Google
    • Indeed
    • Twitter
    • YouTube
  • Tools
w3tweaks.com
  • Effects
    • Scroll Effects
    • Text Effects
    • Shadow
  • Essentials
    • Arrows
    • Buttons
    • Background Patterns
    • Border Examples
    • Cards
    • Color Palettes
    • Dividers
    • Link styles
    • Loaders
    • Modal Windows
    • Notifications
    • Progress bar
    • Quote styles
    • Spinner
    • Tooltips
  • Media
    • Calendars
    • Carousels
    • Clocks
    • Gallery
    • Music Players
    • Sliders
    • Slideshows
    • Tables
    • Thumbnails
  • Navigation
  • Inputs
    • Range Sliders
    • Checkboxes
    • Toggle Switches
  • Scripts
    • Angularjs
    • Backbone.js
    • bootstrap
    • jQuery
    • ReactJs
    • JavaScript
    • Syntax Highlighters
    • tryit editor
    • PHP
  • API’s
    • Facebook
    • Google
    • Indeed
    • Twitter
    • YouTube
  • Tools
w3tweaks.com
Home Script Angularjs

Enable and Disable drop down box using angularjs ngDisabled

W3TWEAKS by W3TWEAKS
November 26, 2019
in Angularjs

In AngularJs we can able to disable or enable the dropdown like jQuery does. Using ngDisabled function in angularjs we can achive the functionality. Demo will be available at end of the tutorial.

You might also like

Iterate javascript object keys using angularjs ngRepeat

Iterate javascript object keys using angularjs ngRepeat

October 27, 2020
Select all and Deselect all checkboxes in angularjs

Select all and Deselect all checkboxes in angularjs

October 22, 2021

Let’s start the tutorial

AngularJs ng-disabled

Add HTML code

<div class="well" ng-controller="appCtrl">
  <input type="checkbox" ng-model="checked" ng-change="toggleDisablingDropdown()">
  <select name="select" ng-disabled="isDisable">
      <option value="item1">item1</option>
      <option value="item2">item2</option> 
  </select>
</div>

Above code has drop down with checkbox. When check box checked or unchecked the dropdown will be disabled or enabled. Model “checked” id for checkbox and model isDisable for dropdown list.

Add below Angularjs

var app = angular.module('angularDemo', [
  'ngRoute'
]);

app.config(['$routeProvider', function ($routeProvider) {
  $routeProvider
    // Home
    .when("/", {templateUrl: "partials/main.html", controller: "appCtrl"})
    // else Home
    .otherwise("/", {templateUrl: "partials/main.html", controller: "appCtrl"});
}]);

app.controller('appCtrl', function($scope) {
    $scope.toggleDisablingDropdown = function(){
    	$scope.isDisable = $scope.checked;
    };
});

Demo

Tags: AngularjsdemodropdownframeworkJavascriptJavaScript Tutorialsng-disabledngDisabledtutorial
Previous Post

Tutorial about how to Create Jobs portal using Indeed API

Next Post

How to import joomla modules inside any custom components

W3TWEAKS

W3TWEAKS

Since I've had a strong background in front-end development, I took the initiative to start my own website (w3tweaks.com) to share my knowledge with the world.

Related Stories

Iterate javascript object keys using angularjs ngRepeat

Iterate javascript object keys using angularjs ngRepeat

by W3TWEAKS
October 27, 2020

This tutorial will explain how to get or iterate the JavaScript Object keys / Properties using AngularJs ngRepeat. It is...

Select all and Deselect all checkboxes in angularjs

Select all and Deselect all checkboxes in angularjs

by W3TWEAKS
October 22, 2021

This tutorial will explain how to achieve check all and uncheck all checkbox using angularjs and listing all checked values...

Angularjs and JSON list infinite scroll

Angularjs and JSON list infinite scroll

by Vetrivel Pandian
September 19, 2019

JSON is more better way to transmitting the data in server to client. When you have develop large data application,...

Angularjs Jasmine Service Dependency Injection

Angularjs Jasmine Service Dependency Injection

by W3TWEAKS
November 26, 2019

This tutorial will explain how to write the Jasmine unit test case for angularjs service dependency injection. End of the...

Next Post
How to import joomla modules inside any custom components

How to import joomla modules inside any custom components

Discussion about this post

Popular Posts

100 Creative CSS Cards

41 Multi step HTML forms

13 Free HTML & CSS Dashboard Template Designs

20 HTML & CSS pricing tables

49 CSS Tables

14 Best CSS Dark Mode

11 CSS Shopping Cart UI/UX

42 Cool CSS Avatars For Better UI

89 Best CSS Toggle Switches

55 Useful handpicked CSS Buttons with examples and demos

w3tweaks

We bring you the best frontend collections that will fix perfect for news, magazine, personal blog, etc. Check our landing page for details.

  • Effects
    • Scroll Effects
    • Text Effects
    • Shadow
  • Essentials
    • Arrows
    • Buttons
    • Background Patterns
    • Border Examples
    • Cards
    • Color Palettes
    • Dividers
    • Link styles
    • Loaders
    • Modal Windows
    • Notifications
    • Progress bar
    • Quote styles
    • Spinner
    • Tooltips
  • Media
    • Calendars
    • Carousels
    • Clocks
    • Gallery
    • Music Players
    • Sliders
    • Slideshows
    • Tables
    • Thumbnails
  • Navigation
  • Inputs
    • Range Sliders
    • Checkboxes
    • Toggle Switches
  • Scripts
    • Angularjs
    • Backbone.js
    • bootstrap
    • jQuery
    • ReactJs
    • JavaScript
    • Syntax Highlighters
    • tryit editor
    • PHP
  • API’s
    • Facebook
    • Google
    • Indeed
    • Twitter
    • YouTube
  • Tools