1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Can a form submission refresh the page even without using [FormGroup]?

Discussão em 'Angular' iniciado por Omar, Julho 4, 2025.

  1. Omar

    Omar Guest

    I'm making a multi-step form, the issue I'm facing on step-one is the page is refreshing instead of moving to the next step after the form gets submitted my .html file goes like this:

    <form (ngSubmit)="submit()">
    <h1>Form Number 1</h1>
    <label>First Name</label>
    <input type="text" [formControl] = "firstName">
    <button type="submit">Next</button>
    </form>


    And in my .ts file I have the following code:

    firstName = new FormControl("", Validators.required)
    constructor(private route:Router, private ac:ActivatedRoute){}
    submit(){
    this.route.navigate(["../two"], {relativeTo: this.ac })
    }


    Also is there any good way to handle this form that has only one input

    Thank you in advance

    Continue reading...

Compartilhe esta Página