There is no directive with “exportAs” set to “ngModel” angular4

Asked
Active3 hr before
Viewed126 times

6 Answers

exportasdirectivengmodel
90%

The example I put together is the best reference,,Please tell us about your environment:,I put together an example that is easy to get running at:,Angular version: 2

Example_snippet/controller/utility/_exportas.js/ [X] bug report [ ] feature req. . .
[X] bug report
   [] feature request[] support request
load more v
88%

Ask questionsNG 2,1

Example_snippet/controller/utility/_exportas.js/ [X] bug report [ ] feature req. . .
[X] bug report
   [] feature request[] support request
Step 2 continued with zone.js:355 Unhandled Promise . . .
zone.js:355
Unhandled Promise rejection: Template parse errors:
There is no directive with "exportAs" set to "ngModel" ("
placeholder="Name"
[(ngModel)="model.name"
[ERROR ->]#name="ngModel"
required
/>
"): AppComponent@9:16 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
   There is no directive with "exportAs" set to "ngModel" ("
   placeholder="Name"
   [(ngModel)="model.name"
   [ERROR ->]#name="ngModel"
   required
   />
   "): AppComponent@9:16
   at TemplateParser.parse (http://localhost:8080/dist/bundle.js:12402:19)
   at RuntimeCompiler._compileTemplate (http://localhost:8080/dist/bundle.js:30826:51)
   at http://localhost:8080/dist/bundle.js:30731:83
   at Set.forEach (native)
   at compile (http://localhost:8080/dist/bundle.js:30731:47)
   at ZoneDelegate.invoke (http://localhost:8080/dist/bundle.js:69130:28)
   at Zone.run (http://localhost:8080/dist/bundle.js:69023:43)
   at http://localhost:8080/dist/bundle.js:69389:57
   at ZoneDelegate.invokeTask (http://localhost:8080/dist/bundle.js:69163:37)
   at Zone.runTask (http://localhost:8080/dist/bundle.js:69063:47)consoleError @ zone.js:355_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386
   zone.js:357Error: Uncaught (in promise): Error: Template parse errors:(…)consoleError @ zone.js:357_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386
load more v
72%

Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,I forgot adding ngModel directive to my input control but had added #currentPassword="ngModel" to my form, The imports etc were all in place

Example_snippet/controller/utility/_exportas.js/ <form [formGroup]="changePassw. . .
<form [formGroup]="changePasswordForm">
   <label for="currentPassword">Current Password</label>
   <input formControlName="currentPassword">
   <button type="submit">Change Password</button>
</form>
Step 2 continued with constructor(formBuilder: FormB. . .
constructor(formBuilder: FormBuilder) {
   this.changePasswordForm = formBuilder.group({
      currentPassword: new FormControl('',
         Validators.compose([Validators.required, Validators.minLength(6)]))
   });
}
Step 3 continued with <small *ngIf="changePasswordFo. . .
<small *ngIf="changePasswordForm.get('currentPassword').hasError('required')">Required!</small>
<small *ngIf="changePasswordForm.get('currentPassword').hasError('minlength')">Minimum 6 chars</small>
load more v
65%

If you use template-driven forms, add FormsModule to your @NgModule,,If you use model-driven forms, add ReactiveFormsModule to your @NgModule

Example_snippet/controller/utility/_directive.js/ import { NgModule } from . . .
import {
   NgModule
} from '@angular/core';
import {
   BrowserModule
} from '@angular/platform-browser';
import {
   FormsModule,
   ReactiveFormsModule
} from '@angular/forms'; // <== add the imports!

import {
   AppComponent
} from './app.component';

@NgModule({
   imports: [
      BrowserModule,
      FormsModule, // <========== Add this line!
      ReactiveFormsModule // <========== Add this line!
   ],
   declarations: [
      AppComponent
      // other components of yours
   ],
   bootstrap: [AppComponent]
})
export class AppModule {}
75%

Hello I am getting this error while trying to pass data from page to page in ionic,There is no directive with "exportAs" set to "ngModel",Hashtag is to reference to dom elements, cancel selecting

Example_snippet/controller/utility/_directive.js/ <ion-item> <ion-label . . .
<ion-item>
   <ion-label stacked>Patient Username</ion-label>
   <ion-input type="text" placeholder="P_JhonDoe" formControlName="p_username" [(ngModel)]="PatientUsername" #ctl="ngModel"></ion-input>
</ion-item>
40%

Example_snippet/controller/utility/_directive.js/ Check that you have imported t. . .
Check that you have imported the component itself
for which you are trying to use the form.