angular: Validate multiple dependent fields

前端 未结 5 1274
予麋鹿
予麋鹿 2021-02-02 09:06

Let\'s say I have the following (very simple) data structure:

$scope.accounts = [{
   percent: 30,
   name: \"Checking\"},
 { percent: 70,
   name: \"Savings\"}]         


        
5条回答
  •  悲&欢浪女
    2021-02-02 09:36

    You can check angularui library (ui-utility part). It has ui-validate directive.

    One way you can implement it then is

    
    

    On the controller create the method checkOverflow that return true or false based on account calculation.

    I have not tried this myself but want to share the idea. Read the samples present on the site too.

提交回复
热议问题