Reconcile Angular.js and Bootstrap form validation styling

前端 未结 12 2059
刺人心
刺人心 2020-12-22 18:53

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

12条回答
  •  太阳男子
    2020-12-22 19:48

    I think it's too late to reply but hope you are going to love it:

    CSS you can add other type of controls like select, date, password etc

    input[type="text"].ng-invalid{
        border-left: 5px solid #ff0000;
        background-color: #FFEBD6;
    }
    input[type="text"].ng-valid{
        background-color: #FFFFFF;
        border-left: 5px solid #088b0b;
    }
    input[type="text"]:disabled.ng-valid{
        background-color: #efefef;
        border: 1px solid #bbb;
    }
    

    HTML: no need to add anything in controls except ng-required if it is

    
    

    Just try it and type some text in your control, I find it really handy and awesome.

提交回复
热议问题