title: check in if ngmodel or forms are dirty or has input
body: <p>how to check in angular if ngmodel or forms are dirty or has input using form fields but not using formgroup.</p>
  <p>I wanted to check if 5 of the inputs fields has value or dirty I want to show like a message but how do we check if for example 5 fields from DealFields or ngModel dealDispositionFormFields are dirty or has inputs ? Thank you .</p>
  <p>#tscode</p>
  <pre><code>    class DealDispositionFormFields {
        dealName:string;
        summary:string;
        dealDispositionType: string;
        terminationPayment:number;
        effectiveDate: string;
        totalBrokerCommission: number;
        effectiveDateString: string;
        dealId: number;
  }
      
      @Component({
        selector: 'app-deal-idle-disposition',
        templateUrl: './deal-idle-disposition.component.html',
        styleUrls: ['./deal-idle-disposition.component.css']
      })
      export class DealIdleDispositionComponent implements OnInit {
             
               ngOnInit(): void {   
                  this.dealDispositionFormFields = new DealDispositionFormFields();
                }
          
          checkIf5FieldsAreDirty() {
          ...
          }
  </code></pre>
  <p>#html code</p>
  <pre><code>&lt;div id=&quot;deal-form-container&quot; *ngIf=&quot;isEditing&quot;&gt;
          &lt;div id=&quot;deal-form-wizard-top&quot; *ngIf=&quot;dealDispositionFormFields.dealDispositionType === 'Buyout'&quot;&gt;
            &lt;mat-form-field appearance=&quot;fill&quot;&gt;
              &lt;mat-label&gt;Deal Name&lt;/mat-label&gt;
              &lt;input 
                matInput
                [(ngModel)]=&quot;dealDispositionFormFields.dealName&quot;
                [required]=&quot;isExistingDeal&quot;&gt;
            &lt;/mat-form-field&gt;
            &lt;mat-form-field appearance=&quot;fill&quot;&gt;
              &lt;mat-label&gt;Summary of Deal&lt;/mat-label&gt;
              &lt;textarea 
                matInput
                class=&quot;resize-none&quot;
                [(ngModel)]=&quot;dealDispositionFormFields.summary&quot;
                [rows]=&quot;5&quot;
                [required]=&quot;isExistingDeal&quot;&gt;
              &lt;/textarea&gt;
            &lt;/mat-form-field&gt;
            &lt;mat-form-field appearance=&quot;fill&quot;&gt;
              &lt;mat-label&gt;Termination Payment&lt;/mat-label&gt;
              &lt;input 
                matInput
                (keyup) = &quot;computeBuyout()&quot;
                mask=&quot;separator.0&quot; 
                thousandSeparator=&quot;,&quot;
                [allowNegativeNumbers]=&quot;false&quot;
                [(ngModel)]=&quot;dealDispositionFormFields.terminationPayment&quot;
                [required]=&quot;isExistingDeal&quot;&gt;
                &lt;span matPrefix *ngIf=&quot;dealDispositionFormFields.terminationPayment&quot;&gt;$&lt;/span&gt;
            &lt;/mat-form-field&gt;
            &lt;mat-form-field appearance=&quot;fill&quot;&gt;
              &lt;mat-label&gt;Effective Date&lt;/mat-label&gt;
                &lt;input matInput
                  (dateChange)=&quot;computeBuyout()&quot;
                  [matDatepicker]=&quot;effectiveDate&quot; 
                  [(ngModel)]=&quot;dealDispositionFormFields.effectiveDate&quot;
                  [required]=&quot;isExistingDeal&quot;&gt;
                &lt;mat-datepicker-toggle matSuffix [for]=&quot;effectiveDate&quot;&gt;&lt;/mat-datepicker-toggle&gt;
                &lt;mat-datepicker #effectiveDate&gt;&lt;/mat-datepicker&gt;
            &lt;/mat-form-field&gt;
            &lt;mat-form-field appearance=&quot;fill&quot;&gt;
              &lt;mat-label&gt;Total Broker Commission&lt;/mat-label&gt;
              &lt;input 
                matInput
                (keyup) = &quot;computeBuyout()&quot;         
                mask=&quot;separator.0&quot; 
                thousandSeparator=&quot;,&quot;
                [allowNegativeNumbers]=&quot;false&quot;
                [(ngModel)]=&quot;dealDispositionFormFields.totalBrokerCommission&quot;
                [required]=&quot;isExistingDeal&quot;&gt;
                &lt;span matPrefix *ngIf=&quot;dealDispositionFormFields.totalBrokerCommission&quot;&gt;$&lt;/span&gt;
            &lt;/mat-form-field&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  </code></pre>