发布于 2017-04-28 05:24:55 | 101 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的AngularJS教程,程序狗速度看过来!

AngularJS 前端JS框架

AngularJS诞生于Google是一款优秀的前端JS框架,已经被用于Google的多款产品当中。AngularJS有着诸多特性,最为核心的是:MVC、模块化、自动化双向数据绑定、语义化标签、依赖注入,等等。


本篇文章主要介绍了angularjs的select使用及默认选中设置,非常具有实用价值,需要的朋友可以参考下

我最近在研究angularjs学习的道路上,那么今天也算个学习笔记吧!

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';
      }); 

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持phperz。



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务