Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorial</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> </head> <body> <form ng-app="myApp" name="Form" ng-controller="urlCtrl"> <h3>input[url] directive example in AngularJS</h3> Enter URL: <input type="url" name="input" ng-model="value" required> <span ng-show="Form.input.$error.required">Required!</span> <span ng-show="Form.input.$error.url">Not valid url!</span> <p>URL = {{value}}</p> <p>Form.input.$valid = {{Form.input.$valid}}</p> <p>Form.input.$error = {{Form.input.$error}}</p> <p>Form.$valid = {{Form.$valid}}</p> <p>Form.$error.required = {{!!Form.$error.required}}</p> <p>Form.$error.url = {{!!Form.$error.url}}</p> </form> <script> var app = angular.module('myApp', []); app.controller('urlCtrl', function($scope) { }); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.