Angular 学习笔记——标签指令
<!DOCTYPE html> <html lang="en" ng-app="myApp"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript" src="js/angular-1.3.0.js"></script> <script> var m1 = angular.module('myApp',[]); m1.controller('may',['$scope',function($scope){ $scope.text = 'hello'; }]) </script> </head> <body> <div ng-controller='may'> <form novalidate name="myform"> <input name="mytext" type="text" ng-model='text' required ng-minlength='5' ng-pattern='/^[a-zA-Z]+$/'> <div>{{myform.mytext.$valid}}</div> <div>{{myform.mytext.$invalid}}</div> <div>{{myform.mytext.$pristine}}</div> <div>{{myform.mytext.$dirty}}</div> <div>{{myform.mytext.$error}}</div> </form> </div> </body> </html>