Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Angular Error: Can't bind to 'ngModel' since it isn't a known property of 'input'.ngtsc(-998002)

04.02.2023 (👁5656)

Angular Error: Can't bind to 'ngModel' since it isn't a known property of 'input'.ngtsc(-998002)

 

Angular Input in Formular

 

Fehlermeldung in Component.html

Can't bind to 'ngModel' since it isn't a known property of 'input'.ngtsc(-998002)

 

<div *ngIf="article" >

    <h1>Id{{article.idArticle}}</h1>

 

    <input [(ngModel)]="article.title" placeholder="Title" />

 

</div>

 

 

 

Lösung:

Add Form in app.modules.ts

imports: [

    BrowserModule,

    AppRoutingModule, //*imports app-routing file

    HttpClientModule,  //for web-api cll

    FormsModule

 

 

 

Ein Bild, das Text, Monitor, Screenshot, Bildschirm enthält.

Automatisch generierte Beschreibung

Lösung in app.module.ts die FormsModule hinzufügen

Komplette app.module.ts

import { NgModule } from '@angular/core';

import { BrowserModule } from '@angular/platform-browser';

import { HttpClientModule } from '@angular/common/http';  //*for url to web-api

import { AppRoutingModule } from './app-routing.module';

import { FormsModule } from '@angular/forms';

 

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

import { ListArticlesComponent } from './components/articles/list-articles/list-articles.component';

import { EditArticleComponent } from './components/articles/edit-article/edit-article.component';

import { ReadArticleComponent } from './components/articles/read-article/read-article.component';

 

@NgModule({

  //*Insert Components in Declatation

  declarations: [

    AppComponent,

    ListArticlesComponent,

    EditArticleComponent,

    ReadArticleComponent,

  ],

  //*Insert Modules in Import

  imports: [

    BrowserModule,

    AppRoutingModule, //*imports app-routing file

    HttpClientModule,  //for web-api cll

    FormsModule

  ],



  providers: [],

  bootstrap: [AppComponent]

})

export class AppModule { }

 

 

 

 

Oder..

optional (property) EditArticleComponent.article?: Article

Can't bind to 'ngModel' since it isn't a known property of 'input'.ngtsc(-998002)

edit-article.component.ts(6, 52): Error occurs in the template of component EditArticleComponent.

Type 'Event' is not assignable to type 'string'.ngtsc(2322)

edit-article.component.ts(6, 52): Error occurs in the template of component EditArticleComponent.