Need to Default select an Angular JS Radio Button

后端 未结 3 1844
刺人心
刺人心 2021-01-19 01:00

I am new to Angular JS and I am trying to create a set of radio buttons. Creating the buttons was the easy part, but I am having problems figuring out how to default select

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-19 01:35

    General suggestion, avoid using '{{}}' use ng-bind (This will not related to question, its just good practice )

    Use

    ng-value="true"
    

    If you want to control from controller.js then use

    ng-checked="default_option"
    

    and control it in controller.js

    $scope.default_option = true
    

提交回复
热议问题