select2未第二次加载图像

时间:2014-06-26 14:39:05

标签: jquery angular-ui jquery-select2 ui-select2 angularjs-select2

我正在使用带有anular js的select2来显示带有图像的下拉列表,我正在实现它以便在第一次加载页面时显示它,

之后当我导航到另一个页面然后回到同一页面时图像没有显示,我没有找到我的代码中出现的问题

任何人都可以帮我找到解决方案

first time page loads

after navigating to another page

这是我的代码

function format1(operator) {
        if (!operator.id) return operator.text; 
        var data = angular.fromJson(operator.id);
        var name  = data.countryIsoAlpha3Code.toLowerCase();
        if(name.length>0)
           return "<label><img  src='/static/img/flags/"+name+"_flag.png'/> " + operator.text+"</label>";
    }

    $("#e3").select2({
        formatResult: format1,
        formatSelection: format1,
        escapeMarkup: function(m) { return m; }
    });

0 个答案:

没有答案