# \[(ngModel)\]="binding" ionic 7

**URL:** <https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390>\
**Category:** Ionic Framework\
**Created:** [April 4, 2023, 5:44pm UTC](https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390 "2023-04-04T17:44:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alepaduaf](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@alepaduaf](https://forum.ionicframework.com/u/alepaduaf)\
**Post date:** [April 4, 2023, 5:44pm UTC](https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390/1 "2023-04-04T17:44:37Z")

</div>

how to update [(ngModel)]=“binding” for new ionic 7

ionic 6  
\<ion-input type=“password” [(ngModel)]=“binding” required=“true”\>

now ionic 7 ?

---

<div class="post-metadata">

**Author:** ![RaulGM](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/raulgm/32/144112_2.png) [@RaulGM](https://forum.ionicframework.com/u/RaulGM)\
**Post date:** [April 4, 2023, 6:48pm UTC](https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390/2 "2023-04-04T18:48:55Z")

</div>

It works the same. Maybe try adding a name property with the name you’d like. It works for me.

`<ion-input type=“password” [(ngModel)]=“binding” required=“true” name="binding">`

Do you get any error? It would be helpful to see it.

---

<div class="post-metadata">

**Author:** ![alepaduaf](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@alepaduaf](https://forum.ionicframework.com/u/alepaduaf)\
**Post date:** [April 4, 2023, 6:57pm UTC](https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390/3 "2023-04-04T18:57:44Z")

</div>

\<ion-input type=“password” [(ngModel)]=“campoSenha” required=“true”\>

Can’t bind to ‘ngModel’ since it isn’t a known property of ‘ion-input’.

1. If ‘ion-input’ is an Angular component and it has ‘ngModel’ input, then verify that it is included in the ‘@Component.imports’ of this component.
2. If ‘ion-input’ is a Web Component then add ‘CUSTOM\_ELEMENTS\_SCHEMA’ to the ‘@Component.schemas’ of this component to suppress this message.
3. To allow any property add ‘NO\_ERRORS\_SCHEMA’ to the ‘@Component.schemas’ of this component.ngtsc(-998002)

home.page.ts(23, 33): Error occurs in the template of component HomePage.

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

home.page.ts(23, 33): Error occurs in the template of component HomePage.

import { Component, Renderer2 } from ‘@angular/core’;  
import { IonicModule } from ‘@ionic/angular’;

import { AppComponent} from ‘./…/app.component’  
import { DadosRota } from ‘./…/models/dados-rota’;  
import { Inflogin } from ‘./…/models/inflogin’;

import { HTTP } from ‘@awesome-cordova-plugins/http/ngx’;

import { Router, NavigationExtras } from ‘@angular/router’;  
import { NavController, AlertController } from ‘@ionic/angular’;

@Component({  
selector: ‘app-home’,  
templateUrl: ‘home.page.html’,  
styleUrls: [‘home.page.scss’],  
standalone: true,  
imports: [IonicModule],  
})  
export class HomePage {

login: string = ‘’;  
senha: string = ‘’;  
mensagem: string = ‘’;  
campoLogin: string = ‘’;  
campoSenha: string = ‘’;

constructor(  
public navCtrl: NavController,  
private router: Router,  
public alertController: AlertController,  
private http: HTTP,  
private renderer: Renderer2,  
) { }

---

<div class="post-metadata">

**Author:** ![RaulGM](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/raulgm/32/144112_2.png) [@RaulGM](https://forum.ionicframework.com/u/RaulGM)\
**Post date:** [April 4, 2023, 8:58pm UTC](https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390/4 "2023-04-04T20:58:57Z")

</div>

It looks like you are generating the '[(ngModel)]`within a .component, not a page. In a page, if you notice, in the`@Component ()`decorator, you will find a`standalone: true`and`imports`. Add imports: [FormsModule]` to your component and that’s it.

---

<div class="post-metadata">

**Author:** ![alepaduaf](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@alepaduaf](https://forum.ionicframework.com/u/alepaduaf)\
**Post date:** [April 5, 2023, 1:00pm UTC](https://forum.ionicframework.com/t/ngmodel-binding-ionic-7/232390/5 "2023-04-05T13:00:38Z")

</div>

It worked, thank you very much
