I've multiple directives which fetch their data from the database. In one case I have all the directives in one screen. This means that when the screen is loading each dropdown/field is filled one by one: first you see field A being field, then field B get's his value, then field C, etc. etc. I don't want this, I want that all the data is displayed at once.
How can I achieve this?
Here is one example of a directive. I have about 10 of these directives.
app.directive("environmentDropdown", ['EnvironmentService', function (EnvironmentService) {
return {
restrict: 'E',
template: '<select class="form-control" data-ng-options="e.Id as e.Name for e in environments"></select>',
scope: {
},
replace:true,
link: function (scope, element, attributes) {
EnvironmentService.getEnvironments().then(function (response) {
scope.environments = response;
});
}
}
}])