Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update options in runtime #17

Open
AlissonRS opened this issue Aug 4, 2016 · 2 comments
Open

Update options in runtime #17

AlissonRS opened this issue Aug 4, 2016 · 2 comments

Comments

@AlissonRS
Copy link

I managed to populate a dropdown using a predefined array of options like the sample code in oficial page, like this:

// HTML
<div ng-dropdown-multiselect="" options="example11data" selected-model="example11model" extra-settings="example11settings" group-by="gender"></div>

// JavaScript $scope.selectedPeople = [];
$scope.examplePeople = [
{id: 1, label: "David", gender: 'M'},
{id: 2, label: "Jhon", gender: 'M'},
{id: 3, label: "Lisa", gender: 'F'},
{id: 4, label: "Nicole", gender: 'F'},
{id: 5, label: "Danny", gender: 'M'}
];

Then I have a button which loads some data from my api, and I'd like to update the dropdown options, based on this data. So I did something like this:

        // Inside some controller method, called on button click....
        myService.getData()
        .then(function (data) {

            $scope.examplePeople = data; // Updating the existing....

            console.log($scope.examplePeople); // Check if the array has nwe items come from api

        });

I expected the options to be updated, since Angular is two-way binding, instead it keeps the old options. Am I missing something, or do I need to call something explicitly to reload the dropdown options?

Many thanks, awesome work done by you!!!

@SynRJ
Copy link

SynRJ commented Nov 29, 2016

Hey,

I have the same issue. I'd like to be able to add options to an existing dropdown multiselect.

@abdo-host
Copy link

I have the same issue

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

No branches or pull requests

3 participants