Angular valuechanges call multiple times while Page loading

Discussão em 'Angular' iniciado por pushp, Fevereiro 13, 2025.

  1. pushp

    pushp Guest

    I am using angular 4 and i am checking is any value is changed by user or not? In my page there are more than 100 control(textbox ,dropdown and editable grid)

    I need to check only if any value is changed or not. For that i am using below code but it is called multiple times while pageload.

    How i can avoid this.i need valuechange will execute only on when user change any value.


    import { Component, OnInit, ViewChild, AfterViewInit, HostListener, OnChanges, DoCheck, AfterViewChecked,OnDestroy } from "@angular/core";


    @ViewChild('fromNote') fnotes;

    ngAfterViewInit() {
    this.fnotes.valueChanges.subscribe(val => {
    alert('changed');
    });
    }

    Continue reading...

Compartilhe esta Página