diff --git a/src/components/checkbox/checkbox.js b/src/components/checkbox/checkbox.js
index 67ab925795d..0a256df471f 100644
--- a/src/components/checkbox/checkbox.js
+++ b/src/components/checkbox/checkbox.js
@@ -111,7 +111,9 @@ function MdCheckboxDirective(inputDirective, $mdInkRipple, $mdAria, $mdConstant,
scope.$apply(function() {
// Toggle the checkbox value...
- ngModelCtrl.$setViewValue( !ngModelCtrl.$viewValue, ev && ev.type);
+ var viewValue = attr.ngChecked ? attr.checked : !ngModelCtrl.$viewValue;
+
+ ngModelCtrl.$setViewValue( viewValue, ev && ev.type);
ngModelCtrl.$render();
});
}
diff --git a/src/components/checkbox/demoBasicUsage/index.html b/src/components/checkbox/demoBasicUsage/index.html
index e8d42e65283..055138fe86d 100644
--- a/src/components/checkbox/demoBasicUsage/index.html
+++ b/src/components/checkbox/demoBasicUsage/index.html
@@ -1,5 +1,6 @@
-
+
+
Using ngModel:
Checkbox 1: {{ data.cb1 }}
diff --git a/src/components/checkbox/demoSyncing/index.html b/src/components/checkbox/demoSyncing/index.html
new file mode 100644
index 00000000000..f2e098c7848
--- /dev/null
+++ b/src/components/checkbox/demoSyncing/index.html
@@ -0,0 +1,30 @@
+
+
Using ngChecked:
+
+
+
+
+
+
+
+
+
+
+ Two or more items are selected
+ Selected: {{ selected }}
+
+
+
diff --git a/src/components/checkbox/demoSyncing/script.js b/src/components/checkbox/demoSyncing/script.js
new file mode 100644
index 00000000000..ba7b2ecfcd3
--- /dev/null
+++ b/src/components/checkbox/demoSyncing/script.js
@@ -0,0 +1,18 @@
+
+angular.module('checkboxDemo1', ['ngMaterial'])
+
+.controller('AppCtrl', function($scope) {
+
+ $scope.items = [1,2,3,4,5];
+ $scope.selected = [];
+
+ $scope.toggle = function (item, list) {
+ var idx = list.indexOf(item);
+ if (idx > -1) list.splice(idx, 1);
+ else list.push(item);
+ };
+
+ $scope.exists = function (item, list) {
+ return list.indexOf(item) > -1;
+ };
+});
diff --git a/src/components/checkbox/demoSyncing/style.css b/src/components/checkbox/demoSyncing/style.css
new file mode 100644
index 00000000000..3d083d9bd3a
--- /dev/null
+++ b/src/components/checkbox/demoSyncing/style.css
@@ -0,0 +1,26 @@
+.checkboxDemo1 div {
+ clear: both;
+}
+.checkboxDemo1 md-checkbox {
+ float: left;
+}
+
+legend {
+ color : #0000ba;
+}
+
+p {
+ padding-left : 10px;
+}
+
+.info {
+ padding-left:13px;
+}
+
+div.standard {
+ padding:10px; padding-left:15px;
+}
+
+fieldset.standard {
+ margin-left:10px;
+}