Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

AngularJS ng-checked Directive

AngularJS ng-checked Instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS Examples

Select one or select all options:

<

body

ng-app=

""

<

p

My:

<

/p

<

input

type=

"checkbox"

ng-model=

"all"

Check all

<

br

<

br

<

input

type=

"checkbox"

ng-checked=

"all"

Volvo

<

br

<

input

type=

"checkbox"

ng-checked=

"all"

Ford

<

br

<

input

type=

"checkbox"

ng-checked=

"all"

Mercedes

<

/body

Try it »


Definition and Usage

ng-checked The directive sets the checked attribute of a checkbox or radio button.

If both the ng-checked If the attribute returns true, the checkbox or radio button will be selected.


Syntax

<

input

type=

"checkbox|radio"

ng-checked=

"expression"

<

/input

with type checkbox or radio elements are supported.


Parameter value

Value Description
expression If it returns true, the element option will be selected.

AngularJS Reference Manual AngularJS Reference Manual