Skip to content

Commit a12058e

Browse files
committed
Quashing bugs
Fixed modelObject on radio_group. Removed unneeded classes on checkbox label. ngOptions now works on select elements.
1 parent 6a8b1ea commit a12058e

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

dist/angular-forms.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,16 @@ angular.module('angularforms', [])
242242
html += "\"";
243243
html += "\" name=\"" + f + "\" id=\"fld_" + f + "\" ";
244244
html += this.addInputClass(fld);
245-
if (typeof fld.optionArray === 'object') {
246-
// optionArray defined as an inline array
247-
this.scope[this.form.name + '_' + f + '_options'] = fld.optionArray;
248-
html += "ng-options=\"itm.id as itm.label for itm in " + this.form.name + '_' + f + '_options' + "\" ";
249-
}
250-
else {
251-
// optionArray is a string, the name of an existing scope variable
252-
html += "ng-options=\"itm.id as itm.label for itm in " + fld.optionArray + "\" ";
245+
if (fld.optionArray) {
246+
if (typeof fld.optionArray === 'object') {
247+
// optionArray defined as an inline array
248+
this.scope[this.form.name + '_' + f + '_options'] = fld.optionArray;
249+
html += "ng-options=\"itm.id as itm.label for itm in " + this.form.name + '_' + f + '_options' + "\" ";
250+
}
251+
else {
252+
// optionArray is a string, the name of an existing scope variable
253+
html += "ng-options=\"itm.id as itm.label for itm in " + fld.optionArray + "\" ";
254+
}
253255
}
254256
for (attr in fld) {
255257
if (attr !== 'label' && attr !== 'type' && attr !== 'srOnly' && attr !== 'class' && attr !== 'optionArray' &&
@@ -307,12 +309,6 @@ angular.module('angularforms', [])
307309
for (i=0; i < fld.options.length; i++) {
308310
fld.options[i].type = 'radio';
309311
fld.options[i].labelClass = 'radio-inline';
310-
fld.options[i].ngModel = (fld.ngModel) ? fld.ngModel : f;
311-
if (this.form.modelObject) {
312-
fld.options[i].ngModel = (fld.ngModel) ? this.form.modelObject + '.' + fld.ngModel : this.form.modelObject + '.' + f;
313-
} else {
314-
fld.options[i].ngModel = (fld.ngModel) ? fld.ngModel : f;
315-
}
316312
html += this.indicator(f, fld.options[i]);
317313
}
318314
html += "</div><!-- radio-group -->\n";
@@ -323,11 +319,8 @@ angular.module('angularforms', [])
323319
// For checkboxes and readio buttons, wrap the input element with a label element
324320
var h = '';
325321
h += "<label ";
326-
if (this.form.horizontal || fld.labelClass) {
327-
h += "class=\"";
328-
h += (this.form.horizontal) ? "control-label " : "";
329-
h += (fld.labelClass) ? fld.labelClass : "";
330-
h += "\"";
322+
if (fld.labelClass) {
323+
h += "class=\"" + fld.labelClass + "\" ";
331324
}
332325
h += (fld.ngShow) ? this.attribute(fld, 'ngShow') : "";
333326
h += (fld.ngHide) ? this.attribute(fld, 'ngHide') : "";

0 commit comments

Comments
 (0)