From b32c750aa59766ec47a016c20ae1a6965dfb2d47 Mon Sep 17 00:00:00 2001 From: Mark Hoffmeyer Date: Fri, 23 Jan 2015 19:01:55 -0500 Subject: [PATCH 1/2] docs(input[checkbox]): Update example to best practice It's not required for the example to function, but it prevents scope weirdness/unexpected behavior when using directives (especially with ngTransclude!). I think it's a good pattern to encourage and might prevent a bug down the road for for people who just scan for the monospace font. See [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes) for mgModel best practices. --- src/ng/directive/input.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 3586815ec541..ae39c8558110 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -902,16 +902,18 @@ var inputType = {
- Value1:
- Value2:
+ Value2:
- value1 = {{value1}}
- value2 = {{value2}}
+ value1 = {{checkboxModel.value1}}
+ value2 = {{checkboxModel.value2}}
From 80a72f0937dc347c458e7944ece502523bba764f Mon Sep 17 00:00:00 2001 From: Mark Hoffmeyer Date: Fri, 23 Jan 2015 20:00:59 -0500 Subject: [PATCH 2/2] Update input.js Update tests to reflect new model. --- src/ng/directive/input.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index ae39c8558110..7c2ca0791ab0 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -918,14 +918,14 @@ var inputType = { it('should change state', function() { - var value1 = element(by.binding('value1')); - var value2 = element(by.binding('value2')); + var value1 = element(by.binding('checkboxModel.value1')); + var value2 = element(by.binding('checkboxModel.value2')); expect(value1.getText()).toContain('true'); expect(value2.getText()).toContain('YES'); - element(by.model('value1')).click(); - element(by.model('value2')).click(); + element(by.model('checkboxModel.value1')).click(); + element(by.model('checkboxModel.value2')).click(); expect(value1.getText()).toContain('false'); expect(value2.getText()).toContain('NO');