Answer the question
In order to leave comments, you need to log in
How to embed an Angular form on a page using uiRouting?
Based on this material https://scotch.io/tutorials/angular-routing-using-... did this:
https://order-price.codio.io/#/home , but when adding a new one to any page form code:
<form ng-app="myApp" ng-controller="validateCtrl"
name="myForm" novalidate>
<p>Комментарий: *<br>
<input type="text" name="comment" ng-model="comment" placeholder="Не менее 5 символов" pattern=".{5,}" required>
<span style="color:red" ng-show="myForm.comment.$dirty && myForm.comment.$invalid">
<span ng-show="myForm.comment.$error.required">Comment is required.</span>
</span>
<span class="error" ng-show="myForm.comment.$error.pattern">
Слишком короткое сообщение</span>
</p>
<p>Имя: *<br>
<input type="text" name="user" ng-model="user" placeholder="Ваше имя" required>
<span style="color:red" ng-show="myForm.user.$dirty && myForm.user.$invalid">
<span ng-show="myForm.user.$error.required">Username is required.</span>
</span>
</p>
<p>Email: *<br>
<input type="email" name="email" ng-model="email" placeholder="Ваш email" required>
<span style="color:red" ng-show="myForm.email.$dirty && myForm.email.$invalid">
<span ng-show="myForm.email.$error.required">Email is required.</span>
<span ng-show="myForm.email.$error.email">Invalid email address.</span>
</span>
</p>
<p>
<input type="submit"
ng-disabled="myForm.comment.$invalid && myForm.comment.$invalid || myForm.user.$invalid && myForm.user.$invalid ||
myForm.email.$invalid && myForm.email.$invalid">
</p>
</form>
<script>
var app = angular.module('myApp', []);
app.controller('validateCtrl', function($scope) {
$scope.comment = '';
$scope.user = '';
$scope.email = '';
});
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question