import { Component , OnInit } from '@angular/core' ; import { FormBuilder , FormGroup , Validators } from '@angular/forms' ; import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper' ; title @ Component ( { selector : 'stepper-errors-example' , templateUrl : 'stepper-errors-example.html' , styleUrls : [ 'stepper-errors-example.css' ] , providers : [ { provide : STEPPER_GLOBAL_OPTIONS , useValue : { showError : true } } ] } ) export class StepperErrorsExample implements OnInit { firstFormGroup : FormGroup ; secondFormGroup : FormGroup ; constructor ( private _formBuilder ) { } ngOnInit ( ) { this . firstFormGroup = this . _formBuilder . group ( { firstCtrl : [ '' , Validators . required ] } ) ; this . secondFormGroup = this . _formBuilder . group ( { secondCtrl : [ '' , Validators . required ] } ) ; } }