I am currently working on a program that requires the input data to only show if the input field is touched once. Unfortunately, I am not getting the expected result as nothing is displayed in the span tag (and there are no errors in the console). Can someone offer some assistance?
HTML:
<html>
<head>
<!-- Script Files -->
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<input type="text" name="person" ng-model="name"/><span ng-show="person.$touched">{{name}}</span>
<script>
//module declaration
var app = angular.module('myApp',[]);
//controller declaration
app.controller('myCtrl', function($scope) {
$scope.name = "Enter Name";
});
</script>
</body>
</html>
Note:
In this specific page, I am unable to utilize any form element. I need to trigger the ng-show event based on ng-touched, ng-untouched, ng-prestine, but without wrapping it within a form.