irossimoline / angular4-material-table

Angular 4 table based on @angular/cdk table structure, to allow row insertion, edition, validation and deletion.
MIT License
55 stars 25 forks source link

Can't bind to 'formControl' since it isn't a known property of 'input'. #12

Closed pdvbalaji closed 6 years ago

pdvbalaji commented 6 years ago

Hello sir,

I try to implement your code in my project but getting errors like this , Can you please help to solve this problem . Thank you

Can't bind to 'formControl' since it isn't a known property of 'input'. (" <mat-cell *matCellDef="let row">

][formControl]="row.validator.controls['name']" [readonly]="!row.editing" placeholder="Name" [(ngModel"): ng:///AppModule/FormGenerationComponent.html@5:23 Can't bind to 'ngModel' since it isn't a known property of 'input'. (" ][(ngModel)]="row.currentData.name" matInput>
    </mat-cell>

"): ng:///AppModule/FormGenerationComponent.html@5:115 Can't bind to 'formControl' since it isn't a known property of 'input'. (" <input [ERROR ->][formControl]="row.validator.controls['age']" type="number" placeholder="Age" [(ngModel)]="row.curren"): ng:///AppModule/FormGenerationComponent.html@13:23 Can't bind to 'ngModel' since it isn't a known property of 'input'. (" <input [formControl]="row.validator.controls['age']" type="number" placeholder="Age" [ERROR ->][(ngModel)]="row.currentData.age" matInput> "): ng:///AppModule/FormGenerationComponent.html@13:101 No provider for NgControl (" <mat-cell *matCellDef="let row">

[ERROR ->] [ERROR ->]
irossimoline commented 6 years ago

Hi @pdvbalaji, did you forget to import FormsModule/ReactiveFormsModule in your own module?

pdvbalaji commented 6 years ago

I added Forms Module ,But i did not add ReactiveFormsModule ,shall i add it . Small help irossimoline can you give me the link which is working , sample project I will download and run . if it work I will update in my project . Please help Below is my package.json

{ "name": "mat-sidenav-menu", "version": "2.0.0", "scripts": { "ng": "ng", "start": "ng serve", "test": "ng test", "e2e": "ng e2e", "build": "ng build", "build-prod": "ng build -prod -aot --no-extract-license" }, "license": "ISC", "dependencies": { "@angular/animations": "^5.2.5", "@angular/cdk": "^5.2.5", "@angular/common": "^5.2.5", "@angular/compiler": "^5.2.5", "@angular/core": "^5.2.5", "@angular/forms": "^5.2.5", "@angular/http": "^5.2.5", "@angular/material": "^5.2.5", "@angular/platform-browser": "^5.2.5", "@angular/platform-browser-dynamic": "^5.2.5", "@angular/router": "^5.2.5", "ag-grid": "^17.1.1", "ag-grid-angular": "^17.1.0", "angular": "^1.7.0", "angular2-moment": "^1.9.0", "core-js": "^2.5.3", "rxjs": "^5.5.6", "zone.js": "^0.8.20" }, "devDependencies": { "@angular/cli": "1.7.4", "@angular/compiler-cli": "^5.2.5", "@angular/language-service": "^5.2.5", "@types/jasmine": "2.6.0", "@types/node": "8.0.57", "codelyzer": "4.1.0", "jasmine-core": "2.8.0", "jasmine-spec-reporter": "4.2.1", "karma": "1.7.1", "karma-chrome-launcher": "2.2.0", "karma-cli": "1.0.1", "karma-coverage-istanbul-reporter": "1.3.0", "karma-jasmine": "1.1.0", "karma-jasmine-html-reporter": "0.2.2", "material-design-icons-iconfont": "^3.0.3", "protractor": "5.2.0", "ts-node": "3.3.0", "tslint": "5.9.1", "typescript": "2.6.2" }, "typings": "dist/aot/index.d.ts", "main": "dist/aot/index.js", "module": "dist/aot/index.js" }

pdvbalaji commented 6 years ago

plz help to solve this , I am using typescript with dotnet

irossimoline commented 6 years ago

@pdvbalaji, if you are using formControl inside an input you should import ReactiveFormsModule.

This SO question talks about the same problem that you are experiencing.

irossimoline commented 6 years ago

@pdvbalaji, could you solve the issue?

irossimoline commented 6 years ago

@pdvbalaji

As no answer received I'll assume you could solve it and I'll close this issue. If you keep having issues to make it work you can open a new issue.