angularjs-dropdown-multiselect icon indicating copy to clipboard operation
angularjs-dropdown-multiselect copied to clipboard

TypeError: $scope.selectedModel.push is not a function Stack trace:

Open sunkarareddy opened this issue 8 years ago • 1 comments

                            <div   ng-show="inputtype[inputtemplate.id]==true">
                                <label>Product Line&nbsp;&nbsp;&nbsp;</label>
                                <div class="selectlabelstyle">

                                    <div id="{{inputtemplate.label+inputtemplate.id}}" ng-dropdown-multiselect="" options="productlines"  selected-model="PL+inputtemplate.id"  checkboxes="true" extra-settings="example14settings"></div>
                                </div>

                            </div>
                        </div>

I am trying with the above snippet where i am assigning selected-model w.r.t ng-repeat value inputtemplate.id

I generated the scope valriables dynamically as below

var the_string = "PL"+key;//key is values from loop

// Get the model var model = $parse(the_string);

        var emptyarray=[];

// Assigns a value to it model.assign(self, emptyarray);

Page is loading with out any issue but when i select a value in multiselect dropdown, getting TypeError: $scope.selectedModel.push is not a function Stack trace: Please help and thanks in advance.

sunkarareddy avatar Dec 14 '17 23:12 sunkarareddy

@sunkarareddy selected-model should be Array, Just convert that selected-model as array then your problem will be solved.

Shreeshag avatar Jan 03 '18 06:01 Shreeshag