machineboy2045 / angular-selectize

angular-selectize
MIT License
201 stars 115 forks source link

selectize - generated markup does not have the pass on attributes like name= to generated <input> #123

Open bhantol opened 8 years ago

bhantol commented 8 years ago

There are all sorts of things not desirable the way the HTML is generated with respect to the how it generates the element.


       <selectize class="form-control dropdown input-medium" 
                       name="selectSomethingImportant"
                       ng-model="data.selectedItems" 
                       config="myConfig" 
                       options="availableOptions" 
                       placeholder="Select something value="">
       </selectize>

Using selectize as an attribute


       <input     class="form-control dropdown input-medium" 
                       name="selectSomethingImportant"
                       ng-model="data.selectedItems" 
                       config="myConfig" 
                       options="availableOptions" 
                       placeholder="Select something value="" selectize>
       </input>

This generates following markup at runtime when targeted as element selectize (vs attribute)

    <selectize tabindex="-1" 
               class="form-control dropdown input-medium ng-pristine ng-untouched ng-valid ng-isolate-scope selectized ng-valid-required" 
               name="selectSomethingImportant"
               style="line-height: inherit; display: none;"
               ng-model="data.selectedItems" 
               config="myConfig" 
               options="availableOptions" 
               placeholder="Select something value="">
    </selectize>
    <div class="selectize-control form-control dropdown input-medium ng-pristine ng-untouched ng-valid ng-isolate-scope single">
        <div class="selectize-input items not-full ng-valid ng-pristine has-options">
            <input  tabindex="0" style="left: 0px; width: 77px; position: relative; opacity: 1;" 
                    type="text" 
                    placeholder="Select Reason" 
                    autocomplete="off">
        </div>
        <div class="selectize-dropdown single form-control dropdown input-medium ng-pristine ng-untouched ng-valid ng-isolate-scope" 
             style="left: 0px; top: 34px; width: 795px; display: none; visibility: visible;">
             <div class="selectize-dropdown-content">
              <div class="option" data-value="42" data-selectable="">Option 1</div>
              <div class="option" data-value="31" data-selectable="">Option 2</div>
              <div class="option" data-value="28" data-selectable="">Option 3</div>
             </div>
        </div>
    </div>
PhiLhoSoft commented 8 years ago

Most of these remarks should be issues on the Selectize control (which isn't much maintained nowadays). Particularly the issue with the placeholder, which has already an issue on the Selectize project: https://github.com/selectize/selectize.js/issues/851