Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Ion-toggle does not receive value at view entry

$
0
0

@JoseGonzaga wrote:

Hello, I have an ion-toggle component that is bound to an object through the [(ngModel)] but even the endpoint looking for the paca value to load the object the component does not get the property value. Here is the code:

Service (Endpoint) method

atualizaRealizacaoEntrega() : Observable<boolean>{
      return this.http.put<boolean>(`${CONF_API.baseUrl}/vendedores/vendedor/realizaentrega`,null);
}

View method to call

atualizaRealizacaoEntrega(){
    this.vendedorService.atualizaRealizacaoEntrega().subscribe(response=>{
    }, error=>{
      console.log(error);
    })
  }

Loading the object into the view entry:

ionViewDidEnter() {
    this.auxiliarService.prepararJanela();
    this.authService.validarUsuario();
    this.carregarVendedor();
  }

I made a test with console.log () to know if the object was actually loading in the view entry, the object is loading normally.

The component in view:

          <ion-card-content>
              <ion-item>
                  <ion-label>Faz entrega?</ion-label>
                  <ion-toggle [(ngModel)]="vendedor.fazEntrega" (ionChange)="atualizaRealizacaoEntrega()"></ion-toggle>
              </ion-item>
          </ion-card-content>

The method atualizaRealizacaoEntrega() is working perfectly by making the property change in the backend.

How do I get the view to show the correct value on the ion-toggle when I enter the view and the method to load the object?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>