Я нашел свое решение.вот мое решение, если у кого-то возникнут проблемы с такой же проблемой -
запишите этот код в свой js-файл
component("email", {
bindings: { ngModel: '<' },
require: { ngModelCtrl: 'ngModel' },
template:
`<input type="{{$ctrl.type}}" class="{{$ctrl.classname}}" placeHolder="{{$ctrl.placeholder}}" name="{{$ctrl.name}}" ng-model='$ctrl.ngModel'
ng-change="$ctrl.ngModelChange()" required>
<div ng-messages="$ctrl.formref[$ctrl.name].$error" ng-show="$ctrl.formref[$ctrl.name].$touched">
<p ng-message="required">Providing a {{$ctrl.placeholder}} is mandatory.</p>
<p ng-message="email">{{$ctrl.placeholder}} is invaild</p></div>`,
bindings: {
formref: '<',
name: '@',
placeholder: '@',
classname: '@',
type: '@',
modelname:'='
},
controller: function() {
this.ngModelChange = () => {
this.ngModelCtrl.$setViewValue(this.ngModel);
};
}
Вот код html-файла
<email classname="form-control" name="Email" type="email" ng-model="email_id"
placeholder="Email Address" formref="myForm" ></email>
Спасибо за помощь всем