angularjs记事本
来源:互联网 发布:java void 编辑:程序博客网 时间:2024/06/06 00:30
<!DOCTYPE html><html><head><meta charset="UTF-8"><title></title><script type="text/javascript" src="../AngularJS/angular.js" ></script><script>var haha = 3;var app = angular.module("myApp",[]);//自定义过滤器app.filter("myFilter",function(){return function(text){//alert("fasd");if(text.indexOf("敏感字符")>=0){//alert("asdfasdf");alert("包含敏感字符")return text.replace(/敏感字符/g,"***");}return text;}});app.controller("myCtrl",function($scope){$scope.newRecord = "";$scope.selectRecord = "";$scope.records = ["早上花了5块钱吃早饭","中午花了20块钱吃早饭"];$scope.addRecord = function(){if($scope.newRecord == "" || $scope.newRecord == null){ alert("输入内容为空");}else{$scope.records.unshift($scope.newRecord);alert($scope.records[2]);}};var flag = true;$scope.selectRecordMethod = function(){for(record in $scope.records){if($scope.records[record] == $scope.selectRecord){alert("已经存在");flag = false;}}if(flag){alert("不存在");}}/*$scope.myFilter = function(text){var reg = /敏感字符/;if(reg.test(text)){return text.replace(/敏感字符/g,"***");}}*/});</script></head><body ng-app="myApp" ng-controller="myCtrl"><center>记事本<div style="width: 300px; height: 250px; border: 1 solid blue; background-color:#A6E1EC;"><p ng-repeat="record in records ">{{record | myFilter }}</p></div><br/>输入框:<input type="text" ng-model="newRecord" /><button ng-click="addRecord()">记录</button><br/>搜索:<input type="text" ng-model="selectRecord" /><button ng-click="selectRecordMethod()">记录</button></center></body></html>
阅读全文
0 0
- angularjs记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- 记事本
- Python括号配对 水
- Leetcode 521 Longest Uncommon Subsequence I
- MVC的工作原理
- C语言学习内容总结2017/10/24
- 7. Reverse Integer LeetCode c++
- angularjs记事本
- 总结
- Leetcode 532 K-diff Pairs in an Array
- oracle sql 格式化 价格 为三位加逗号,如 12,222,210.73
- HTML5网页文本设计(主要是一些标签)
- 教训
- 基础练习 杨辉三角形
- Leetcode 575 Distribute Candies
- Tomcat中因时区设置问题导致与系统时间不一致问题