LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

    
  


  

{{title}}

{{content}}

Checkbox

The database table stores the boolean data as a tinyint 1 or 0, but AngularJS evaluates boolean values as strings, but they have provided a mechanism to make sure the bindings work (for auto-selected checkboxes for example) by using ng-true-value="1" and ng-false-value="0"

{{item.id}} Click this to change data value below

{{list1 | json}}

Radio Buttons (Unfinished)

I did not finish the radio buttons because the AngularJS documentation for checkbox made it so easy to use the checkbox.

Yes No

{{obj2 | json}}
CSS
.panel {
  width:90%;
  margin:2em auto;
}
JS
var lb = "• "; // used for console.log()
var myApp = angular.module("myApp", []);

myApp.controller('myController', function($scope) {
  $scope.title = 'AngularJS Checkbox vs. Radio Buttons for boolean data';
  $scope.content = '';
  
  $scope.list1 = [
    {
      "id": "1",
      "data": "0",
    },
    {
      "id": "2",
      "data": "1",
    },
  ];
  
  $scope.obj2 = [
    {
      "id": "1",
      "name": "thingie 2",
      "data": "0",
    },
  ];
});

Description

AngularJS Checkbox vs. Radio Buttons for boolean data
Term
Tue, 11/28/2017 - 13:40

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv