Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9305597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:57:54+00:00 2026-06-18T23:57:54+00:00

I am using Angular with Bootstrap. Here is the code for reference: <form name=newUserForm

  • 0

I am using Angular with Bootstrap. Here is the code for reference:

<form name="newUserForm" ng-submit="add()" class="" novalidate>
    <input type="text" class="input" ng-model="newUser.uname" placeholder="Twitter" ng-pattern="/^@[A-Za-z0-9_]{1,15}$/" required></td>
    <button type="submit" ng-disabled="newUserForm.$invalid" class="btn btn-add btn-primary">Add</button>
</form>

Bootstrap has styles for invalid fields in the form of input:invalid {.... }; these kick in when the field is empty. Now I also have some pattern matching via Angular. This creates odd cases when “:invalid” is off, but “.ng-invalid” is on, which would require me to re-implement bootstrap CSS classes for the “.ng-invalid” class.

I see two options, but having trouble with both

  • Make Angular use some custom classname instead of “ng-valid” (I don’t know how to do this).
  • Disable html5 validation (I thought that that’s what “novalidate” attribute in the form tag should do, but couldn’t get it work for some reason).

The Angular-Bootstrap directives out there don’t cover styling.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:57:55+00:00Added an answer on June 18, 2026 at 11:57 pm

    Use Bootstrap’s “error” class for styling. You can write less code.

    <form name="myForm">
      <div class="control-group" ng-class="{error: myForm.name.$invalid}">
        <label>Name</label>
        <input type="text" name="name" ng-model="project.name" required>
        <span ng-show="myForm.name.$error.required" class="help-inline">
            Required</span>
      </div>
    </form>
    

    EDIT:
    As other answers and comments point out – in Bootstrap 3 the class is now “has-error”, not “error”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using angular-ui and bootstrap in the same web application and I've an issue
I'm using angular.js and (for the sake of argument) bootstrap. Now I need to
I'm trying to create a POST request using angular.js to this Django view. class
Im unable to get fb name printed using angular js. I'm not sure what
I'm creating two POST calls. One using a django form and one using angular
What is the use of using angular tag in css ie, .class << span
I want to achieve read/write access control for select input using angularjs and angular-ui
I have created a simple code editor using Angular JS & old fashioned JavaScript
I have an angular template which looks like this... <div ng-repeat=message in data.messages ng-class=message.type>
I am trying to dynamically add css to my html head using angular js.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.