JavaScript
- 9 ответов
- 0 вопросов
6
Вклад в тег
function validateInSequence(
...validators: ( (formControl: FormControl) => any )[]
): (formControl: FormControl) => any {
return function (formControl: FormControl): any {
for (let i = 0; i < validators.length; i++) {
const validationResult = validators[i](formControl);
if (validationResult !== null) {
return validationResult;
}
}
return null;
};
}
new FormControl('', [validateInSequence(Validators.required, Validators.email)]);
data.forEach(async (message) => {
if (!message.pinned) {
await message.delete().catch(writeErr); //message.delete - возвращает Promise
}
});
let declarations = [SomeComponent];
if (!environment.production) {
const devDeclarations = [/*ваши дев компоненты*/];
declarations = declarations.concat(devDeclarations); // равносильно [...declarations, ...devDeclarations]
}
@NgModule({
declarations,
/*...*/
})
export class SomeModuleClass {}