From 348f1ca4f40554a87f4d008ed6a13dc0936db564 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Tue, 27 Dec 2016 22:21:08 +0100 Subject: [PATCH] Fix strange bug where select boxes in edit marker/line are not initialised properly (#39) --- frontend/app/fieldTypes/fieldTypes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/app/fieldTypes/fieldTypes.js b/frontend/app/fieldTypes/fieldTypes.js index 42efc554..bfd40bb2 100644 --- a/frontend/app/fieldTypes/fieldTypes.js +++ b/frontend/app/fieldTypes/fieldTypes.js @@ -38,8 +38,12 @@ el.attr("id", attrs.fmTypeFieldId); el.appendTo(element.empty()); - $compile(el)(scope); - scope.$evalAsync(); // $compile only replaces variables on next digest + + // For some reason, if we call $compile directly, select boxes will not select the right value + // with newer versions of angular + scope.$evalAsync(function() { + $compile(el)(scope); + }); }; scope.$watch(attrs.fmTypeField+".type", update);