Kalaiyarasi M Kalaiyarasi M - 5 months ago 47
HTML Question

Need ng pattern which allows only alphabets space and point or dot(.)

I need to use an ngPattern which will allow only alphabets, space and point or dot(.) in Angularjs.

Answer
<input type="text" ng-model="model" id="input" name="input" ng-pattern="regex" /><br>

 angular.module('ngPatternExample', [])
    .controller('ExampleController', ['$scope', function($scope) {
      $scope.regex = '/^[a-zA-Z\s\.]*$/';
    }]);