angular2 - adding 'pattern' for form builder
<p>I have a pattern for a form builder and I have this:</p>

<pre><code> this.userForm = this.formBuilder.group({
      'postalCode': ['', Validators.pattern('/[A-Za-z][0-9][A-Za-z] [0-9][A-Za-z][0-9]/i')]
    });
</code></pre>

<p>I have a <strong>ValidationService</strong> which I've added a function "getValidatorErrorMessage".</p>

<pre><code>static getValidatorErrorMessage(validatorName: string, validatorValue?: any) {
    let config = {
        'pattern': 'invalid  pattern'
    };

    return config[validatorName];
}
</code></pre>

<p>My template has:</p>

<pre><code>  &lt;div&gt;
        &lt;label for="postalCode"&gt;Postal code (A1A 2J3)&lt;/label&gt;
        &lt;input formControlName="postalCode" id="postalCode" /&gt;
        &lt;control-messages [control]="userForm.controls.postalCode"&gt;&lt;/control-messages&gt;
    &lt;/div&gt;
</code></pre>

<p>But for some odd reason, the validation messages arent displaying if I dont follow the regex code. </p>

<p>You can view the plunkr <a href="http://plnkr.co/edit/uiHLvY48Qfj5UzdzevpS?p=preview" rel="nofollow noreferrer">here</a>.</p>