javascript - EnablingDisabling button through dropdown using Angularjs - Stack Overflow

Hi I have following dropdown <select ng-model="item" ng-options="a.name for a in adda

Hi I have following dropdown

    <select ng-model="item" ng-options="a.name for a in adda" ng-change="onChange()">
        <option value="">
            Add new account
        </option>
    </select>

In my code I have following button..

  <button class="btnS btn-success ctrl-btn" ng-click="save()"> Submit</button>

What i want the button disabled and only be enabled if one of the options in the drop down is selected. Thanks

Hi I have following dropdown

    <select ng-model="item" ng-options="a.name for a in adda" ng-change="onChange()">
        <option value="">
            Add new account
        </option>
    </select>

In my code I have following button..

  <button class="btnS btn-success ctrl-btn" ng-click="save()"> Submit</button>

What i want the button disabled and only be enabled if one of the options in the drop down is selected. Thanks

Share Improve this question asked Jan 31, 2014 at 5:24 J. DavidsonJ. Davidson 3,31714 gold badges56 silver badges105 bronze badges 1
  • Check this link -- > ngDisabled – Amarnath Balasubramanian Commented Jan 31, 2014 at 6:35
Add a ment  | 

1 Answer 1

Reset to default 5

You can use ng-disabled:

<button 
   class="btnS btn-success ctrl-btn" 
   ng-click="save()" 
   ng-disabled="!item"> Submit</button>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745431097a4627393.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信