How to dynamically change the URL in Select2 using AJAX?

纵饮孤独 提交于 2019-12-10 21:53:41

问题


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?


回答1:


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

ajax: {
            url: function () { return '/product/' +$scope.campaign.advertiser + '/tags/'; },
            ...
}


来源:https://stackoverflow.com/questions/28606403/how-to-dynamically-change-the-url-in-select2-using-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!