Search Posts

Category: checkbox

How to set checked property of checkboxes based on value from database using angular js

I have a group of checkboxes which are populated dynamically from database using AngularJs. Now, on edit I want to check the checkboxes whose value is stored in database. Below is the sample code: <div class=”row” > <div class=”col-sm-2″> <label>Select Metal :</label><label style=”color:red”>*&nbsp;</label> </div> <div class=”col-sm-8″> <div ng-repeat=”names in MetalTypes” class=”checkbox-inline” id=”MetalDiv” style=”font-size: larger; margin-left: 20px !important; margin-top: -10px !important;”> <div style=”margin:10px 10px 10px; margin-left:-16px;”> <input type=”checkbox” value=”{{names.Id}}” ng-model=”names.SELECTED” ng-checked=”object[names.Id]” ng-true-value=”‘Y'” ng-false-value=”‘N'” style=”margin-top:2px;” ng-change=”getSelectedMetal()” />{{names.Name}} […]

ionic checklist with object array – how to dertermine if checkbox is checked

my code app.js: jt.controller(‘TheorieCtrl’, function($scope, $window, $ionicPlatform) { // .log($window.localStorage); // Ready functions if ($window.localStorage.getItem(‘themen’) === null) { $scope.themen = [{ name: “Setting1”, checked: false }, { name: “Setting2″, checked: false } ]; } else { $scope.themen = JSON.parse($window.localStorage[‘themen’]); }; $scope.updateThemaLocalStorage = function(items) { $window.localStorage[‘themen’] = JSON.stringify(items); }; }); my html code: <ion-list> <ion-checkbox ng-repeat=”thema in themen track by $index” class=”checkbox-positive item-checkbox-right” type=”checkbox” id=”{{}}” ng-model=”thema.checked” ng-change=”updateThemaLocalStorage(themen)”> {{ }} </ion-checkbox> </ion-list> In a other controller […]

Change style of textarea based on checkbox

I would like to change the style of a textarea if a checkbox is checked and the textarea is empty. A red border should appear. If the textarea is not empty and the checkbox is not checked, the border should disappear. I have tried something like this, but the border is shown even when the textarea is not empty. <input style=”display: inline;” id=”checkbox1″ type=”checkbox” ng-model=”checked”> <textarea name=”” id=”” cols=”5″ rows=”3″ ng-model=”comments” ng-disabled=”request.disableTransfer” ng-pattern=”/^[0-9A-Za-z]*$/” ng-required=”checked”></textarea> This […]

Checkbox in dropdown menu is not checked from previously selected value in AngularJS

I am new to AngularJS. I am trying to get the checkbox to appear as checked from previously selected value. I thought ng-class would do the trick but it’s not. Did I do anything wrong in the code below? Here is my HTML code: <ul class=”dropdown-menu menu-content” uib-dropdown-menu> <li ng-repeat=”value in values” > <label><input type=”checkbox” ng-class=”{‘checked’ : value.selected, ‘active’ : value.selected}” ng-click=”$ctrl.toggleValue(value)”>{{value.valueName}}</label></li> </ul> Source: AngularJS

how to get all data using select all checkbox in table?

Hi I am trying to get all data at a time when I will click on checkbox, but data not coming but when i click one by one data id coming. But my problem is how to get all data in checkbox all in single click. This is HTML code <div id=”wrapper” class=”wrapper”> <div ng-include=”‘views/partials/navigator.html'”></div> <div class=”page-content-wrapper”> <div ng-include=”‘views/partials/header.html'”></div> <div class=”row”> <div class=”col-md-12″> <h3>Student Information</h3> <table id=”example” class=”table”> <tr> <th>Name</th> <th>Mobile</th> <th>Siblling</th> <th>select all <input […]

Toggle Checkboxes AngularJS

I am trying to make checkboxes appear when md-button Delete or Add is selected and to disappear when it is not. The checkbox is automatically hiding like it should because a button hasn’t been pressed yet. When I press the buttons nothing happens. I am using Angular Material to build the app as well. Any help is appreciated HTML <md-menu> <img src=”/imagepathhere” ng-click=”$$event)”> <md-menu-content ng-model=”checkbox”> <md-menu-item> <md-button value=”add”><p>Add</p></md-button> </md-menu-item> <md-menu-item> <md-button value=”delete”><p>Delete</p></md-button> </md-menu-item> </md-menu-content> </md-menu> […]

Filtering list items with ng-repeat from a selection/de-selection of a combination of checkboxes

I have a list of items which are frequently updated, based on changes to a price property. If the price of an item falls below a certain value (below 5) that item has a ‘selected’ property set to true and displayed in the results table (filtered on the selected property). ng-repeat=”item in dataPrices | filter: {selected:true}” I want to add a series of checkboxes which, based on the selection/de-selection of a combination of checkboxes used […]