title: DOMException: "String contains an invalid character" in Angular
body: <p>empolyee.service file:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Empolyee } from './empolyee.model';
  
  @Injectable({
    providedIn: 'root'
  })
  export class EmpolyeeService {
    formData: Empolyee;
    constructor() { }
  }
  </code></pre>
  
  <p>empdata.component file:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { EmpolyeeService } from 'src/app/shared/empolyee.service';
  
  @Component({
    selector: 'app-empdata',
    templateUrl: './empdata.component.html',
    styleUrls: ['./empdata.component.css']
  })
  export class EmpdataComponent implements OnInit {
  
    constructor(private service:EmpolyeeService) { }
  
    ngOnInit() {
    }
  
  }
  </code></pre>
  
  <p>empdata.component:</p>
  
  <pre><code>&lt;form #form="ngForm"&gt;
  &lt;div class="form-group"&gt;
      &lt;label&gt;Name&lt;/label&gt;
      &lt;input type="text" [(ngModel)}="service.formData.name" class="form-control"&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;label&gt;Emp Code&lt;/label&gt;
      &lt;input type="text" [(ngModel)]="service.formData.empcode" class="form-control"&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;label&gt;Mobile&lt;/label&gt;
      &lt;input type="number"[(ngModel)]="service.formData.mobile" class="form-control"&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;label&gt;Role&lt;/label&gt;
      &lt;input type="text" [(ngModel)]="service.formData.role" class="form-control"&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;input type="submit" value="Submit" class="btn btn-lg"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>export class Empolyee {
      empid:number;
      name:string;
      empcode:string;
      mobile:number;
      role:string;
  }
  </code></pre>
  
  <p>This error I have received:</p>
  
  <blockquote>
    <p>[WDS] Disconnected! vendor.js:112996:9</p>
    
    <p>ERROR DOMException: "String contains an invalid character" EmpdataComponent.ngfactory.js:29:12</p>
    
    <p>ERROR CONTEXT 
    Object { view: {…}, nodeIndex: 8, nodeDef: {…}, elDef: {…}, elView: {…} } EmpdataComponent.ngfactory.js:29:12</p>
    
    <p>DOMException: "String contains an invalid character" main.js:442:27 </p>
  </blockquote>
  
  <p>​</p>