示例如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>form demo</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<script src="js/angular.min.1.6.0.js"></script>
</head>
<body ng-app="app" ng-controller="myctrl">
<!--
作者:aaa@163.com
时间:2016-12-22
描述:获取输入框input value,并且在控制台打印日志
-->
<input type="text" placeholder="请输入您的手机号码" ng-model="mob" >
<!--<p>{{mob}}</p>-->
<button class="button button-small" ng-click="getCode()" value="" >点击打印日志</button>
</body>
<script>
var app = angular.module('app', []);
app.controller('myctrl', function($scope,$log) {
$scope.mob='';
$scope.getCode=function(){
console.log('click');
$log.log('value=='+$scope.mob);
$log.info('value=='+$scope.mob);
$log.warn('value=='+$scope.mob);
$log.error('value=='+$scope.mob);
$log.debug('value=='+$scope.mob);
}
});
</script>
</html>
打印日志如下: