Нет директивы с "exportAs", установленным в "ngForm" ("<div> - PullRequest
0 голосов
/ 23 сентября 2019

Я уже прошел Нет директивы с параметром "exportAs", установленным в "ngForm" , но все еще не удается устранить приведенную ниже ошибку.

Ошибка:

ERROR Error: Uncaught (in promise): Error: Template parse errors:
There is no directive with "exportAs" set to "ngForm" ("<div>
    <form novalidate [ERROR ->]#f=ngForm  [formGroup]="pForm">
        <div class="dxp-input">
            <label class="dxp-input"): ng:///StudentModule/StudentComponent.html@1:21
Can't bind to 'formGroup' since it isn't a known property of 'form'. ("<div>
    <form novalidate #f=ngForm  [ERROR ->][formGroup]="pForm">
        <div class="dxp-input">
            <label class="dxp-inputbox-label">"): ng:///StudentModule/StudentModule/StudentComponent.html@1:32
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("gth="0" maxlength="100"

AppModule.java

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';


@NgModule({
  declarations: [
    AppComponent,
    TemplateComponent,
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

myForm

<div>
    <form novalidate #f=ngForm  [formGroup]="pForm">
        <div class="dxp-input">
            <label class="dxp-inputbox-label">
                Program Name
                <span class="dxp-required"><span aria-hidden="true">*</span></span>
            </label>
            <div class="input-container">
                <input type="text" id="" class="input-box" aria-required="true" 
                    autocomplete="off" [(ngModel)]="program.programName"
                    name="StudentName" [disabled]="isEdit? 'disabled' : null" formControlName="programName"  required>
            </div>
            <div class="dxp-error dxp-required" aria-label="Please select this field" id="errMsg1">
                {{errorStudentName}}
            </div>
        </div>
        ......
        ......
        .....
    </form>
<div>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...