diff --git a/app/assets/javascripts/angular/directives/timelines/timeline-column-name-directive.js b/app/assets/javascripts/angular/directives/timelines/timeline-column-name-directive.js index 3297e52d2e..de86e6d57d 100644 --- a/app/assets/javascripts/angular/directives/timelines/timeline-column-name-directive.js +++ b/app/assets/javascripts/angular/directives/timelines/timeline-column-name-directive.js @@ -9,16 +9,16 @@ angular.module('openproject.timelines.directives') localePrefix: '@' }, link: function(scope, element) { - scope.$watch('customFields', function(){ - if (CustomFieldHelper.isCustomFieldKey(scope.columnName)) { + if (CustomFieldHelper.isCustomFieldKey(scope.columnName)) { + scope.$watch('customFields', function(){ var customFieldId = CustomFieldHelper.getCustomFieldId(scope.columnName); if (scope.customFields && scope.customFields[customFieldId]) { element.html(scope.customFields[customFieldId].name); } - } else { - element.html(I18n.t(scope.localePrefix + '.' + scope.columnName)); - } - }); + }); + } else { + element.html(I18n.t(scope.localePrefix + '.' + scope.columnName)); + } } };