How to load dynamic data using node package “ng-multiselect-dropdown”
In Angular(6) project, I am using a node package named ng-multiselect-dropdown for a dropdown input field. I am facing difficulty
to load dynamic data in a dropdown list. Is there any way to load dynamic data while using ng-multiselect-dropdown or Is there any
similar node package which provided the same functionality of ng-multiselect-dropdown.
Thank you.
<ng-multiselect-dropdown [data]="userDropdownList"
[(ngModel)]="selectedItems" [settings]="dropdownSettings"
(onSelect)="onItemSelect($event)"
(onSelectAll)="onSelectAll($event)">
</ng-multiselect-dropdown>
userDropdownList = ;
ngOnInit() {
this.departmentService.getUsers(this.authService.getUser().client_id)
.subscribe((response: any) => {
for (let data of response.data) {
this.userDropdownList.push({ '_id': data._id,
'name': data.firstname + ' ' + data.lastname })
}
},
error => {
console.log("error :", error);
})
}

|
show 1 more comment
In Angular(6) project, I am using a node package named ng-multiselect-dropdown for a dropdown input field. I am facing difficulty
to load dynamic data in a dropdown list. Is there any way to load dynamic data while using ng-multiselect-dropdown or Is there any
similar node package which provided the same functionality of ng-multiselect-dropdown.
Thank you.
<ng-multiselect-dropdown [data]="userDropdownList"
[(ngModel)]="selectedItems" [settings]="dropdownSettings"
(onSelect)="onItemSelect($event)"
(onSelectAll)="onSelectAll($event)">
</ng-multiselect-dropdown>
userDropdownList = ;
ngOnInit() {
this.departmentService.getUsers(this.authService.getUser().client_id)
.subscribe((response: any) => {
for (let data of response.data) {
this.userDropdownList.push({ '_id': data._id,
'name': data.firstname + ' ' + data.lastname })
}
},
error => {
console.log("error :", error);
})
}

What’s the issue, is service working fine ?
– super cool
Jan 1 at 16:11
Service is working fine. The data I am getting from the HTTP request is not showing in dropdown list.
– Md. Amanullah
Jan 1 at 16:20
If I declare static array of object like below code, then it works. But from http request , it is not working: this.userDropdownList = [ { _id: "5ae89f362c6f957fe0ddf173", name: "Raja Khan" }, { _id: "5ae96638dbceb53af3344d1b", name: "Ubaid Showkat" }, { _id: "5afd5ec12e275b636bbda827", name: "Keninteiten Daz" }, { _id: "5b2b752ddd444f78c3f775c5", name: "Calvin Shehryar" }, { _id: "5b2c993116e48626a589ab70", name: "test s" } ];
– Md. Amanullah
Jan 1 at 16:26
code looks fine, did you try declaring the same static thing inside.subscribe((response: any) => {
?
– super cool
Jan 2 at 4:13
Yes. I declared the same variable.
– Md. Amanullah
Jan 2 at 6:52
|
show 1 more comment
In Angular(6) project, I am using a node package named ng-multiselect-dropdown for a dropdown input field. I am facing difficulty
to load dynamic data in a dropdown list. Is there any way to load dynamic data while using ng-multiselect-dropdown or Is there any
similar node package which provided the same functionality of ng-multiselect-dropdown.
Thank you.
<ng-multiselect-dropdown [data]="userDropdownList"
[(ngModel)]="selectedItems" [settings]="dropdownSettings"
(onSelect)="onItemSelect($event)"
(onSelectAll)="onSelectAll($event)">
</ng-multiselect-dropdown>
userDropdownList = ;
ngOnInit() {
this.departmentService.getUsers(this.authService.getUser().client_id)
.subscribe((response: any) => {
for (let data of response.data) {
this.userDropdownList.push({ '_id': data._id,
'name': data.firstname + ' ' + data.lastname })
}
},
error => {
console.log("error :", error);
})
}

In Angular(6) project, I am using a node package named ng-multiselect-dropdown for a dropdown input field. I am facing difficulty
to load dynamic data in a dropdown list. Is there any way to load dynamic data while using ng-multiselect-dropdown or Is there any
similar node package which provided the same functionality of ng-multiselect-dropdown.
Thank you.
<ng-multiselect-dropdown [data]="userDropdownList"
[(ngModel)]="selectedItems" [settings]="dropdownSettings"
(onSelect)="onItemSelect($event)"
(onSelectAll)="onSelectAll($event)">
</ng-multiselect-dropdown>
userDropdownList = ;
ngOnInit() {
this.departmentService.getUsers(this.authService.getUser().client_id)
.subscribe((response: any) => {
for (let data of response.data) {
this.userDropdownList.push({ '_id': data._id,
'name': data.firstname + ' ' + data.lastname })
}
},
error => {
console.log("error :", error);
})
}


asked Jan 1 at 15:55
Md. AmanullahMd. Amanullah
217
217
What’s the issue, is service working fine ?
– super cool
Jan 1 at 16:11
Service is working fine. The data I am getting from the HTTP request is not showing in dropdown list.
– Md. Amanullah
Jan 1 at 16:20
If I declare static array of object like below code, then it works. But from http request , it is not working: this.userDropdownList = [ { _id: "5ae89f362c6f957fe0ddf173", name: "Raja Khan" }, { _id: "5ae96638dbceb53af3344d1b", name: "Ubaid Showkat" }, { _id: "5afd5ec12e275b636bbda827", name: "Keninteiten Daz" }, { _id: "5b2b752ddd444f78c3f775c5", name: "Calvin Shehryar" }, { _id: "5b2c993116e48626a589ab70", name: "test s" } ];
– Md. Amanullah
Jan 1 at 16:26
code looks fine, did you try declaring the same static thing inside.subscribe((response: any) => {
?
– super cool
Jan 2 at 4:13
Yes. I declared the same variable.
– Md. Amanullah
Jan 2 at 6:52
|
show 1 more comment
What’s the issue, is service working fine ?
– super cool
Jan 1 at 16:11
Service is working fine. The data I am getting from the HTTP request is not showing in dropdown list.
– Md. Amanullah
Jan 1 at 16:20
If I declare static array of object like below code, then it works. But from http request , it is not working: this.userDropdownList = [ { _id: "5ae89f362c6f957fe0ddf173", name: "Raja Khan" }, { _id: "5ae96638dbceb53af3344d1b", name: "Ubaid Showkat" }, { _id: "5afd5ec12e275b636bbda827", name: "Keninteiten Daz" }, { _id: "5b2b752ddd444f78c3f775c5", name: "Calvin Shehryar" }, { _id: "5b2c993116e48626a589ab70", name: "test s" } ];
– Md. Amanullah
Jan 1 at 16:26
code looks fine, did you try declaring the same static thing inside.subscribe((response: any) => {
?
– super cool
Jan 2 at 4:13
Yes. I declared the same variable.
– Md. Amanullah
Jan 2 at 6:52
What’s the issue, is service working fine ?
– super cool
Jan 1 at 16:11
What’s the issue, is service working fine ?
– super cool
Jan 1 at 16:11
Service is working fine. The data I am getting from the HTTP request is not showing in dropdown list.
– Md. Amanullah
Jan 1 at 16:20
Service is working fine. The data I am getting from the HTTP request is not showing in dropdown list.
– Md. Amanullah
Jan 1 at 16:20
If I declare static array of object like below code, then it works. But from http request , it is not working: this.userDropdownList = [ { _id: "5ae89f362c6f957fe0ddf173", name: "Raja Khan" }, { _id: "5ae96638dbceb53af3344d1b", name: "Ubaid Showkat" }, { _id: "5afd5ec12e275b636bbda827", name: "Keninteiten Daz" }, { _id: "5b2b752ddd444f78c3f775c5", name: "Calvin Shehryar" }, { _id: "5b2c993116e48626a589ab70", name: "test s" } ];
– Md. Amanullah
Jan 1 at 16:26
If I declare static array of object like below code, then it works. But from http request , it is not working: this.userDropdownList = [ { _id: "5ae89f362c6f957fe0ddf173", name: "Raja Khan" }, { _id: "5ae96638dbceb53af3344d1b", name: "Ubaid Showkat" }, { _id: "5afd5ec12e275b636bbda827", name: "Keninteiten Daz" }, { _id: "5b2b752ddd444f78c3f775c5", name: "Calvin Shehryar" }, { _id: "5b2c993116e48626a589ab70", name: "test s" } ];
– Md. Amanullah
Jan 1 at 16:26
code looks fine, did you try declaring the same static thing inside
.subscribe((response: any) => {
?– super cool
Jan 2 at 4:13
code looks fine, did you try declaring the same static thing inside
.subscribe((response: any) => {
?– super cool
Jan 2 at 4:13
Yes. I declared the same variable.
– Md. Amanullah
Jan 2 at 6:52
Yes. I declared the same variable.
– Md. Amanullah
Jan 2 at 6:52
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53996848%2fhow-to-load-dynamic-data-using-node-package-ng-multiselect-dropdown%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53996848%2fhow-to-load-dynamic-data-using-node-package-ng-multiselect-dropdown%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What’s the issue, is service working fine ?
– super cool
Jan 1 at 16:11
Service is working fine. The data I am getting from the HTTP request is not showing in dropdown list.
– Md. Amanullah
Jan 1 at 16:20
If I declare static array of object like below code, then it works. But from http request , it is not working: this.userDropdownList = [ { _id: "5ae89f362c6f957fe0ddf173", name: "Raja Khan" }, { _id: "5ae96638dbceb53af3344d1b", name: "Ubaid Showkat" }, { _id: "5afd5ec12e275b636bbda827", name: "Keninteiten Daz" }, { _id: "5b2b752ddd444f78c3f775c5", name: "Calvin Shehryar" }, { _id: "5b2c993116e48626a589ab70", name: "test s" } ];
– Md. Amanullah
Jan 1 at 16:26
code looks fine, did you try declaring the same static thing inside
.subscribe((response: any) => {
?– super cool
Jan 2 at 4:13
Yes. I declared the same variable.
– Md. Amanullah
Jan 2 at 6:52