Search Posts

Category: checkbox

How to make a function call with ng-checked : Angularjs

I need to display data when i checked on a checkbox(for example when i clicked on multiple checkbox i should get the data regarding all checkbox value)for this i have tried ng-checked and call the functions inside this directive but when i have write this in my code a very ridiculous thing happened with me,my system is getting hanged.so i have wrote ng-change for showing my code. <div class=”checkbox checkbox-warning”> <input type=”checkbox” ng-model= “fields” value=”{{f.id}}” […]

How to give default or initial selection for md-checkbox where its data comes from JSON

I have a list of <md-checkbox> where it is repeated using JSON array. I want to give an initial selection for 2 checkboxes. Please help me on this. My js code: $scope.elecselected = []; $scope.toggle = function (elecitem, eleclist) { var idx = eleclist.indexOf(elecitem); if (idx > -1) { eleclist.splice(idx, 1); } else { eleclist.push(elecitem); } console.log(“item:”+elecitem+ ” List:”+ eleclist); }; $scope.exists = function (elecitem, eleclist) { return eleclist.indexOf(elecitem) > -1; }; $scope.electrical = [{“ID”:”161″,”Value”:”ABC”,”Name”:”AAAA […]

AngularJs – Select checkboxes by binding list of selected objects to list of all objects

I have searched for a solution to my problem but have not been able to find the right answer. I have a list of all questions and a list of selected questions. I need to build a list of checkboxes from the list of all questions and check the ones that are in the list of selected questions. When changes are made to the checkboxes, I need the list of selected questions to be updated […]

get checkbox state when onChange is triggered

I’m playing in angular and bootstrap. The question is very trivial. I have input element in my html <label><input (change)=”callFilt()” type=”checkbox” value=””>{{item.name}}</label> I want to get state of checkbox in my callFilt method.I see that it’s possible via ng-model,but I dont want to use any other directives here,is there way to send state of the checkbox? Neither I want to set id of checkbox and get state via ID in my js code. Source: AngularJS

How can we achieve product filter page using angularjs with multi selection of checkboxes?

I have created a tabular page in which i need to filter the table with filters using a left side facets boxes of different category but with multi-selection options and i need to use Angularjs for this requirement. The UI(HTML) is done but i am facing the trouble in the maintaining the checking and un-checking of the checkboxes which are not clearing off. Any helping library can help to achieve the same or we need […]

Angular-4 :Using checkboxes for multi select

Using Angular 4–How can I remove an item from an array when a checkbox is unchecked? Can someone please show the component function that does so would look like??? Thanks a lot. My codes are as follows : **app.component.html:** <div> <h2>SAMPLE</h2> <input [(ngModel)] = “newItem” type=”text” placeholder=”Add Item”> <button (click)=”addItem()”>ADD</button> <ul *ngFor=”let i of Items ; let ind=index” > <li><input type=”checkbox” [checked]=”stat” (click)=”flagged(ind)” >{{i}}</li> </ul> <ul *ngFor=”let f of flaggedItems”><li> <h3>Flagged array : {{f}}</h3> </li></ul> […]

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=”{{thema.id}}” ng-model=”thema.checked” ng-change=”updateThemaLocalStorage(themen)”> {{ thema.name }} </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

Next Page »