Why does adding ngModel to my form break the style of my buttons?

UI Components for Angular
Post Reply
JNogal
Posts: 1
Joined: 16 May 2021, 16:40

16 May 2021, 16:44

I'm pretty new to Angular and PrimeNg and I'm trying to create a simple form where I can ask for some username, password and email. I have two buttons too under the inputs. When I add the ngModel propierty to my inputs, the style of my buttons breaks and they display as simple buttons instead of their PrimeNg version. As soon as I delete the ngModel thingy they get back to their original state. I really do not undertstand why does this happen so if someone could bring some light to the matter I'll be glad.

Here's my code:

Code: Select all

<div class="card text-layout">
    <div class="p-fluid">
        <div class="p-field p-col">
            <label for="email">Email</label><br>
            <input pInputText id="email" type="text" pInputText> 
        </div>
        <div class="p-field p-col">
            <label for="user">Usuario</label><br>
            <input pInputText id="user" type="text" pInputText> 
        </div>
        <div class="p-field p-col">
            <label for="pwd">Contraseña</label><br>
            <input pInputText id="pwd" type="text" pInputText> 
        </div>
    </div>
    <button pButton type="button" class="p-button-success p-button-raised p-button-rounded">Registrarse</button>
</div>

PhilHuhn
Posts: 126
Joined: 19 Sep 2018, 02:52
Location: Ann Arbor, Michigan USA
Contact:

21 May 2021, 17:53

Hey:

I don't have enough information from your post to give you a specific answer, but I am willing to guess what is happening.

Writing and testing Angular code means spending a lot of time in Chrome developer tools. I am guessing the answer is in red in the console tab of your developer tools.

Additionally, ngModel issue would indicate you are mixing forms techniques. Reactive forms will throw an error in the developer console if you use ngModel and can other issues.

Phil

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests