Having trouble in setting up the default value for the drop down when AngularJS/ng-repeat/custom directive + Select2 JS is used.
1. I avoided using ng-options as the directive priority is 0.
2. I tried setting the priority for the custom directive 'select2Directive' to a number less than 1000, but still no luck.
Plunker @http://plnkr.co/edit/Csy5FqDSQbErTm2fNPac。感謝任何幫助。謝謝。AngularJS - Ng-repeat - Select2 JS - 問題設置默認值
好吧,最後我解決了這個問題,使用超時。 $ timeout(function(){scope。$ apply(select2Inst.select2('val',attrs ['directive-name']));},0); – Jay
更新的工作版本: – Jay