No provider for ControlContainer - Angular 5
import FormsModule
in addition to ReactiveFormsModule
Import FormsModule
and ReactiveFormsModule in views.module.ts
(custome module file) file works for me :
views.module.ts
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';import { CommonModule } from '@angular/common';import { RouterModule } from '@angular/router';import { FormsModule, ReactiveFormsModule } from '@angular/forms';@NgModule({ imports: [ CommonModule, RouterModule, FormsModule, ReactiveFormsModule, ... ], declarations: [ ... ], exports: [ ... ], schemas: [NO_ERRORS_SCHEMA]})export class ViewsModule { }
I'm not sure why the error seems to be pointing to the anchor tag outside of the form element, but it was the form element that was causing the error. Adding FormGroup to the form fixed the problem.
<form role="search" class="navbar-form-custom" [formGroup]="form">