Skip to content

Change the standard multiple element #53

Open

Description

@mystertb

Hi,

thank you for this amazing framework !
I'm trying to change the default multiple behavior.
I want to have a select element and a button below.
When i click on the button ("Ajouter"), the current selected element is appended to a div element below the button.
I implemented the mechanism with the framework, it works well:

image
But there is no connection with the model. The data binding is not occuring.
I changed those lines:

Line 119:

if (!(angular.isDefined(field.multiple) && field.multiple !== false)) {
                  newElement.attr('ng-model', bracket(field.model, attrs.ngModel));
                  // Build parent in case of a nested model
                  setProperty(model, field.model, {}, null, true);
                  }

Line 214:

if (angular.isDefined(field.multiple) && field.multiple !== false) {
                      field["classname"] += " multiple "; 
                  }

Line 308:

 newElement = newElement.wrap('<label class="col-xs-12"></label>').parent();
  newElement.prepend(document.createTextNode(field.label + ' '));

 if (angular.isDefined(field.multiple) && field.multiple !== false) {

                        newElement.append("<div class='col-xs-12 btn btn-default' data-textmultiple='"+field.id+"'>Ajouter</div>");
                        var div = angular.element("<div class='"+field.id+"_multiple' value='myinput'/>");
                                //The binding doesn't work :/
                        div.attr("ng-model",bracket(field.model, attrs.ngModel));
                        newElement.append(div);
                    }

Is there something else to change to have data-binding with the div ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions