Try it
Javascript
Jquery
Angular
Learn Angular
Learn Javascript
Learn Bootstrap
Learn jQuery
Ng-Checked-6
Example of
Ng-Checked
:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </head> <body ng-app="checkedExample"> <div ng-controller="ExampleController"> <div class="container"> <h2>What are your favorite sports?</h2> <div ng-repeat="sport in sports"> <label>{{sport.label}}</label> <input type="checkbox" ng-model="sport.selected" ng-true-value="'YES'" ng-false-value="'NO'"> <label> ng-checked: <input type="checkbox" ng-checked="sport.selected === 'YES'"> </label> <div> Current state: {{sport.selected}} </div> </div> </div> </div> <script> var app = angular.module("checkedExample", []); app.controller('ExampleController', ['$scope', function ($scope) { $scope.sports = [{ label: 'Basketball', selected: 'NO' }, { label: 'Cricket', selected: 'YES' }, { label: 'Tennis', selected: 'NO' }, { label: 'Badminton', selected: 'YES' } ]; }]); </script> </body> </html>
Output
×
Save This try
Title
Description
<p>Example of <code>Ng-Checked</code>:</p>