核心提示:在项目中遇到问题,chosen加载后才会执行angularjs获取数据,解决方案如下:var colorAdminApp = angular.module(colorAdminApp, [ ui.se...
在项目中遇到问题,chosen加载后才会执行angularjs获取数据,解决方案如下:
var colorAdminApp = angular.module('colorAdminApp', [ 'ui.select', 'ui.router', 'ui.bootstrap', 'oc.lazyLoad', 'ngTable', 'ngRoute', //'ngMessages', 'ngResource', 'ngSanitize' ]);
colorAdminApp.controller("RebateOrderListController", RebateOrderListController);
RebateOrderListController.$inject = ['$scope', "NgTableParams", "RebateOrderService"];
function RebateOrderListController($scope, NgTableParams, RebateOrderService) {
}
colorAdminApp.directive('chosen',function(){
var linker = function(scope,element,attr){
scope.$watch('LogisticsPartners',function(){
element.trigger('chosen:updated');
});
element.chosen();
}
return {
restrict: 'A',
link: linker
};
});
自定义一个chosen指令,监听chosen触发更新值的时候,执行一次chosen


