R
R
rinatoptimus2015-04-25 18:32:18
Angular
rinatoptimus, 2015-04-25 18:32:18

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>

it (form) does not work.
How to build it so that it functions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2015-04-26
@telray

It is possible in more detail, what is organized, and what specifically does not work?
And it is very difficult to answer such a question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question