[email protected]综合小实例1

<!DOCTYPE HTML>
<html ng-app="myapp">
<head>
 <title>综合小实例</title>
 <meta charset="utf-8"> 
 <link rel="stylesheet" href="../css/bootstrap.css">
 <script src="../js/angular.js"></script>
 <style>
 .text-warning{color:red;}
 </style>
</head>
<body>
<!-- 加上模块module,并把控制器写在模块中,控制器生效 -->
<div  ng-controller="limitText" class="container">
 <span ng-class="{‘text-warning‘:showldWarn()}">剩余字数:{{remaining()}} / 140</span>
 <div class="row">
  <textarea ng-model="message" rows="20" class="col-md-6"></textarea><br>
  输入的是:<span ng-bind="message"></span>
 </div>
 <div class="row">
  <button class="btn btn-default" ng-click="send()" ng-disabled="!hasValidLength()">发送</button>
  <button class="btn btn-default" ng-click="clear()">清除</button>
 </div>
</div>
<script>
var myModule = angular.module("myapp",[]);
myModule.controller(‘limitText‘, [‘$scope‘, function($scope){
 var MAX_LEN = 140;
 $scope.message = "ahsdhiasdh";
 $scope.remaining = function(){                               //返回剩余字数方法
  return MAX_LEN - $scope.message.length;
 }
 $scope.showldWarn = function(){                           //返回差值小于10的判断条件,满足该条件时调用字体标红的样式
  var chazhi = MAX_LEN - $scope.message.length;
  return chazhi < 10;
 }
 $scope.hasValidLength = function(){                       //返回文本长度在有效范围内的方法
  return $scope.message.length <= MAX_LEN;
 }
}])
</script>
</body>
</html>

时间: 2024-08-01 09:03:05

[email protected]综合小实例1的相关文章

[email&#160;protected]较复杂的指令嵌套demo——综合小实例:登陆界面

1.index.html: <!DOCTYPE HTML><html ng-app="app"><head>    <title>custom-directive</title>    <meta charset="utf-8">        <link rel="stylesheet" href="../css/bootstrap.css">

linux下开发,解决cocos2d-x中编译出现的一个小问题, undefined reference to symbol &amp;#39;[email&#160;protected]@GLIBC_2.2.5&amp;#39;

解决cocos2d-x中编译出现的一个小问题 对于cocos2d-x 2.×中编译中,若头文件里引入了#include "cocos-ext.h",在进行C++编译的时候会遇到例如以下错误: undefined reference to symbol '[email protected]@GLIBC_2.2.5'/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command li

iOS中四种实例变量的范围类型@[email&#160;protected]@[email&#160;protected]

文档上记录是这样的 The Scope of Instance Variables To enforce the ability of an object to hide its data, the compiler limits the scope of instance variables—that is, limits their visibility within the program. 为了强制一个对象隐藏其数据,编译器限制实例变量范围以限制其在程序中的可见性 But to prov

对于[email&#160;protected]的一点小想法

@红薯 老大,首先恭喜[email protected]上线! 对于[email protected], 提几个小建议: 1, 在任务列表deckard切换的时候能不能不刷新页面切换?这样用户体验方面会更好一些: 2,在创建任务 的时候,添加一个子任务选项,比如说把一个模块设为一个parent task,然后可以在它下面创建sub tasks; 3,同样是创建任务的时候,可以添加一个预估耗时的选项. 4,在页面顶部导航栏添加创建新任务的button. 纯属个人意见, 仅供参考.@小编辑 @阿娇O

[email&#160;protected]小细节

关于@RequestBody  参数类型自己的包装类,还是类似String/int,区别: [email protected] LoginParmar parmar String user_number = parmar.getUser_number(); String user_password = parmar.getUser_password(); [email protected] String accessToken JSONObject json = JSONObject.fromO

[email&#160;protected]计划宣传片 XboxOne喜迎大波小游戏(转)

微软Xbox One游戏不够多?别担心,微软的[email protected]计划将带来一大波独立游戏!微软在今天正式公布了即将登陆旗下的Xbox One主机平台的独立游戏阵容,数量多达32款,官方的宣传片也已放出,感兴趣的玩家一起来看看吧! 高清视频截图:

linux shell 实用小实例

判断当前用户是否为root管理员,如果是,则执行tar对/etc/目录执行备份. #!/bin/bash# IF current user is root then backup the /etcif [ "$(id -u)" -eq 0 ];then  tar -czf /root/etc.tar.gz /etc &>/dev/nullelse  echo 'Please switch user on root.'  exit 9fi 要求用户输入密码,判断密码是否正确

[email&#160;protected]路由插件UI-Router

UI-Router是angular路由插件,上一篇我们讲到了angularJS自带路由,可惜在路径嵌套上表现的有所欠缺,而angular-UI-Router插件正好弥补了这一点. [示例]: □.UIRoute3.html:                     //先写总的路由文件 <!doctype html><html ng-app="routerApp"> <head>    <meta charset="utf-8&quo

Spring aop 小实例demo

Hadoop从2.4.0版本开始支持hdfs的ACL,在CDH5.0当中也集成了该特性,下面对其进行一些测试: unnamed user (file owner) 文件的拥有者 unnamed group (file group) 文件的所属组 named user 除了文件的拥有者和拥有组之外,的其它用户 named group 除了文件的拥有者和拥有组之外,的其它用户 mask  权限掩码,用于过滤named user和named group的权限 一.启用ACL: <property>