How can I conditionally require form inputs with AngularJS?

后端 未结 5 985
一生所求
一生所求 2020-11-27 10:08

Suppose we\'re building an address book application (contrived example) with AngularJS.

We have a form for contacts that has inputs for email and phone number, and w

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 10:31

    In AngularJS (version 1.x), there is a build-in directive ngRequired

    
    
     
    

    In Angular2 or above

    
    
     
    

提交回复
热议问题