title: How to fix No provider for ChangeDetectorRef! in Karma-Jasmine Testing
body: <blockquote>
    <p>StaticInjectorError(DynamicTestModule)[MatTable -> ChangeDetectorRef]:    StaticInjectorError(Platform: core)[MatTable -> ChangeDetectorRef]:      NullInjectorError: No provider for ChangeDetectorRef!</p>
  </blockquote>
  
  <pre><code>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
  
  import { MessagesComponent } from './messages.component';
  import { NgModule,CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from '@angular/core';
  import { MatTableModule } from '../../../MessageUtility/node_modules/@angular/material';
  import { HttpClientModule } from '@angular/common/http';
  import { RouterTestingModule  } from '@angular/router/testing';
  
  describe('MessagesComponent', () =&gt; {
    let component: MessagesComponent;
    let fixture: ComponentFixture&lt;MessagesComponent&gt;;
  
    beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
        declarations: [ MessagesComponent ],
      imports:[HttpClientModule,RouterTestingModule,MatTableModule, ],
        schemas: [NO_ERRORS_SCHEMA,NO_ERRORS_SCHEMA]
      })
      .compileComponents();
    }));
  
    beforeEach(() =&gt; {
      fixture = TestBed.createComponent(MessagesComponent);
      component = fixture.componentInstance;
      fixture.detectChanges();
    });
  
    it('should create', () =&gt; {
      expect(component).toBeTruthy();
    });
  });
  </code></pre>