Skip to content

Commit

Permalink
Resolved a stupid error with setting checklist models to empty during…
Browse files Browse the repository at this point in the history
… compile

Resolves GitHub issue #1

Signed-off-by: Daniel Hunsaker <[email protected]>
  • Loading branch information
danhunsaker committed Mar 13, 2014
1 parent 6acd327 commit d98d9cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dynamic-forms.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* DynamicForms - Build Forms in AngularJS From Nothing But JSON
* @version v0.0.0 - 2013-09-24
* @version v0.0.1 - 2014-03-13
* @link http://bitbucket.org/danhunsaker/angular-dynamic-forms
* @license LGPLv3+, http://www.gnu.org/licenses/lgpl-3.0.en.html
*/
Expand Down Expand Up @@ -134,7 +134,7 @@ angular.module('dynform', [])
else if (field.type === 'checklist') {
if (angular.isDefined(field.val)) {model[field.model] = angular.copy(field.val);}
if (angular.isDefined(field.options)) {
model[field.model] = {};
if ( ! (angular.isDefined(model[field.model]) && angular.isObject(model[field.model]))) {model[field.model] = {};}
angular.forEach(field.options, function (option, childId) {
newChild = angular.element('<input type="checkbox" />');
newChild.attr('name', field.model + '.' + childId);
Expand Down Expand Up @@ -469,4 +469,4 @@ angular.module('dynform', [])
};
}]);

/* End of dynamic-forms.js */
/* End of dynamic-forms.js */

0 comments on commit d98d9cd

Please sign in to comment.