<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example - example-url-input-directive</title>
  

  <script src="../../../angular.min.js"></script>
  

  
</head>
<body ng-app="urlExample">
  <script>
  angular.module('urlExample', [])
    .controller('ExampleController', ['$scope', function($scope) {
      $scope.url = {
        text: 'http://google.com'
      };
    }]);
</script>
<form name="myForm" ng-controller="ExampleController">
  <label>URL:
    <input type="url" name="input" ng-model="url.text" required>
  <label>
  <div role="alert">
    <span class="error" ng-show="myForm.input.$error.required">
      Required!</span>
    <span class="error" ng-show="myForm.input.$error.url">
      Not valid url!</span>
  </div>
  <tt>text = {{url.text}}</tt><br/>
  <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
  <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
  <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
  <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
  <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
 </form>
</body>
</html>