1 ng-model="standardCourse.showHours"代替name
2 ng-selected = "1"代替selected="selected",但问题是select下会多出一个无用的option
3 在数据准备时设置,$scope.standardCourse.showHours= '1';
解决多出的一个无用的option


<label for="_sel_show_hours">是否显示课时数</label>
<select id="sel_show_hours" ng-model="standardCourse.showHours" >
<option value="1" ng-selected = "1">显示</option>
<option value="0">不显示</option>

</select>  


radio也是 ng-checked="1",也需要准备数据时设置默认值

准备数据参考
$stateProvider.state('home.standardCourseAdd', {
        url: "/standardCourse/add",
        templateUrl: "/partials/ace/standardCourse/add.html",
        controller: function ($rootScope, $http, $scope, $location, $anchorScroll, $stateParams, $state, $timeout, $compile, Upload) {
            fnPost($scope, $state, $http, {'name': ''}, '/standardCourse/toAdd.do', function (success, data) {
                $scope.standardCourse = data.entity;
                $scope.standardCourse.showHours= '1';

});  

angularjs的select使用及默认选中的更多相关文章

  1. html select 标签设置默认选中

    方法有两种. 第一种通过<select>的属性来设置选中项,此方法可以在动态语言如php在后台根据需要控制输出结果. 1 2 3 4 5 < select  id =  " ...

  2. select 使其默认选中文本不为空

    ```html<select ref="type" v-model="selectedvalue" > <option v-for=" ...

  3. select遍历list默认选中初始值

    <select id="userstatus" name="userstatus">         <c:forEach items=&qu ...

  4. HTML中的<select>标签如何设置默认选中的选项

    方法有两种. 第一种通过<select>的属性来设置选中项,此方法可以在动态语言如php在后台根据需要控制输出结果. 1 2 3 4 5 < select  id =  " ...

  5. struts2设置<s:select>默认选中项的方法

    struts2的select标签中,常用的有以下几个属性:(1)struts2中的select 标签中,必须设置的属性只有一个,即是list.(2)select标签的list中必须有值,不然会报错.如 ...

  6. jQuery 设置select默认选中问题

    在进行其他操作后,恢复select默认选中 html代码: <select id="shai" style="width:150px;margin:5px 50px ...

  7. 修改select下拉选的默认选中值

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  8. Vue 中select option默认选中的处理方法

    在做泰康项目的时候有个需求就是要给select默认选中的样式我的处理方法有两个 1.直接将默认值给  selectedOption <select v-model="selectedO ...

  9. AngularJS的select设置默认值

    AngularJS的select设置默认值 在使用Angular时候使用select标签时会遇到绑定数据指定默认显示值可这样实现 <!DOCTYPE html> <html ng-a ...

随机推荐

  1. Selenium WebDriver 常用API

    public class Demo1 { WebDriver driver; @BeforeMethod public void visit(){ //webdriver对象的声明 System.se ...

  2. Vagrant 手册之 Provisioning - File

    原文地址 Provisioner 名字:"file" Vagrant 的 file provisioner 允许将文件或目录从主机上传到客户机. File provisioning ...

  3. 使用rdb文件进行redis数据迁移--python脚本

    查找了一些redis迁移的方法,一般做法就是 1. 从源数据库把rdb文件保存,然后传到新的主机上,启动新的redis即可 2. 把新的redis当做源数据库的slave,同步数据 今天开发提了一个测 ...

  4. pygame应用——生产者消费者模型

    因为操作系统的一个生产者-消费者拓展作业,以一个飞机大战的模型修改来的 import pygame import time from pygame.locals import * bulletsNum ...

  5. Git015--标签管理

    Git--标签管理 本文来自于:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ ...

  6. VulnStack靶场实战(未完成)

    环境搭建 https://www.cnblogs.com/HKCZ/p/11760213.html 信息收集 目录爆破 这里发现有phpmyadmin目录,这里可以直接获取webshell 参照: h ...

  7. mybatis配置mapper.xml 的基本操作

    XML 映射文件 本文参考mybatis中文官网进行学习总结:http://www.mybatis.org/mybatis-3/zh/sqlmap-xml.html MyBatis 的真正强大在于它的 ...

  8. mybatis学习笔记2

    1.获得插入语句执行之后的自增主键 <insert id="insertUser" parameterType="com.mybatis.po.User" ...

  9. FZU 2187 回家种地 ( 扫描线 + 离散 求矩阵单次覆盖面积 )

    2187 回家种地 Accept: 56    Submit: 230Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Descript ...

  10. UVALive 6270 Edge Case(找规律,大数相加)

    版权声明:本文为博主原创文章,未经博主同意不得转载. vasttian https://blog.csdn.net/u012860063/article/details/36905379 转载请注明出 ...