Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

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

Open
sunkarareddy opened this issue Dec 14, 2017 · 1 comment
Open

Comments

@sunkarareddy
Copy link

{{inputtemplate.label}}
                            <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.

@Shreeshag
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants