感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<input type="text" ng-model="myInput" ng-blur="blur()">
<p>输入的内容为:{{myInput}}</p>
<p>变成小写:{{ x1 }}</p>
<p>变成大写:{{ x2 }}</p>
<p ng-switch = "x3">
是不是字符串:
<label ng-switch-when = "true">是</label>
<label ng-switch-when = "false">不是</label>
<label ng-switch-when = ""></label>
</p>
<p ng-switch = "x4">
是不是数字:
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.blur = function(){
$scope.x1 = angular.lowercase($scope.myInput);
$scope.x2 = angular.uppercase($scope.myInput);
$scope.x3 = angular.isString($scope.myInput);
// angular.isNumber 这里无效
// $scope.x4 = angular.isNumber($scope.myInput);
$scope.x4 = !isNaN($scope.myInput);
}
});
</script>
</body>
</html>
输入 JavaScript 代码……
xxxxxxxxxx
输入 CSS 代码……