title: Angular 2: Compare 2 forms
body: <p>I want to compare if the two values of forms are the same. I have this</p>
  
  <pre><code>if(this.holdForm.value != this.positionForm.value){
      this.enableButton = true;
  }else{
      this.enableButton = false;
  }
  </code></pre>
  
  <p>but it doesn't work. It won't make enableButton true.</p>
  
  <blockquote>
    <p>UPDATED:</p>
  </blockquote>
  
  <pre><code>    this.positionForm = this.fb.group({
              'name' : [position.name, Validators.required],
              'remark': position.remark
          });
  
      this.holdForm = this.fb.group({
          'name' : position.name,
          'remark': position.remark
      });
  
  
  
      this.positionForm.valueChanges.subscribe(data =&gt; {
          this.onValueChanged(data);
          if(this.data.process == 'register'){
              this.enableButton = true;
          }else if(this.data.process == 'update' &amp;&amp; this.holdForm.value != this.positionForm.value){
              this.enableButton = true;
          }else{
              this.enableButton = false;
          }
      });
  </code></pre>