P
P
Pavel Zinoviev2014-03-19 18:48:35
Angular
Pavel Zinoviev, 2014-03-19 18:48:35

How to resolve conflict between angularJS and zurb foundation framework?

function ctrl($scope, $http, $location) {
  $scope.DOM = {
    el: $('#signUp')
  };

  $scope.response = function(){
    alert(123);
  }

  $scope.add = function(){
    $scope.DOM.el.on('valid', $scope.response());
  }
}

When checking the validity of the form using zurb foundation, the $scope.add function is called, regardless of the correctness of the input. I call with ng-submit.
<form action="" method="" data-abide="ajax" ng-controller="ctrl" ng-submit="add()">
  <div class="name-field">
    <label>
      <input type="text" name="name" placeholder="Имя" required ng-model="user.name" />
    </label>
    <small class="error">Необходимо ввести имя</small>
  </div>
  <button type="submit">Нажать</button>
</form>

How to solve the problem correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-03-19
@zombiQWERTY

jQuery in controller? Already at this point, all the concepts of angularjs are violated.
Validation should only happen through ngModel (directives using ngModelCtrl).
In general , there is integration . Foundation with angular

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question