Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically change the URL in Select2 using AJAX?

I am using ui-select2 in angularjs for remote data access. I am having a drop down, based on the value chosen in dropdown the URL present in the ajax call should change dynamically , so that I can get the data from that particular URL.

Is it possible to change the URL dynamically based on the value present in the dropdown?

like image 853
Deepa Mani Avatar asked Jan 19 '26 05:01

Deepa Mani


1 Answers

I've resolved this problem using function in ajax property:

ajax: {
            url: function () { return '/product/' +$scope.campaign.advertiser + '/tags/'; },
            ...
}
like image 162
Ivan Avatar answered Jan 20 '26 19:01

Ivan