Skip to content

Commit bbd675e

Browse files
committed
Fixing up getterSetter = true setting internal ngModel to a function
1 parent 61469d5 commit bbd675e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

examples/02-getterSetter.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<h1>AngularJS Color Picker</h1>
1919
<p>An AngularJS directive for a color picker. No requirement on jQuery.</p>
2020
{{color}}
21+
{{color()}}
2122
<color-picker
2223
ng-model="color"
2324
ng-model-options="{ getterSetter: true }"

src/scripts/controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,14 @@ export default class AngularColorPickerController {
171171
}
172172

173173
init() {
174-
this.internalNgModel = this.ngModel;
175174

176175
// ng model options
177176
if (this.$scope.control[0].$options && this.$scope.control[0].$options.$$options) {
178177
this.ngModelOptions = this.$scope.control[0].$options.$$options;
179178
}
180179

180+
this.internalNgModel = this.ngModelOptions.getterSetter ? this.ngModel() : this.ngModel;
181+
181182
// browser variables
182183
this.chrome = Boolean(window.chrome);
183184
let _android_version = window.navigator.userAgent.match(/Android\s([0-9\.]*)/i);

0 commit comments

Comments
 (0)