2014-07-11 5 views
1

AngularJs에서 새로운 기능으로 내 코드에 문제가 있습니다.AngularJs 마법사 유효성 검사 입력란에서 범위를 찾을 수 없습니다.

내 HTML이 보이는 순간

:

<div class="wizardContainer"> 
<wizard on-finish="finishedWizard()"> 
    <wz-step title="1"> 
     <h1>Question 1</h1> 
     <p>How old are you?</p> 
     <form name="age_form" novalidate ng-submit="signupForm()"> 
      <fieldset> 
       <input type="text" name="age" ng-model="user.age" 
         ng-minlength=1 required> 

       <div class="error-container" 
        ng-show="age_form.age.$invalid && age_form.submitted"> 
        <small class="error" 
          ng-show="age_form.age.$error.required"> 
         Please fill in the field 
        </small> 
        <small class="error" 
          ng-show="age_form.age.$error.minlength"> 
         Please fill in mininum 1 number 
        </small> 
       </div> 
       <button type="submit" class="btn btn-default full-width">go on</span></button> 
      </fieldset> 
     </form> 
    </wz-step> 
    <wz-step title="2"> 
     <h1>Question 2</h1> 
     <p>How are you?</p> 
    </wz-step> 
</wizard> 

내 컨트롤러는 다음과 같습니다 내가 마법사의 첫 번째 단계에서 제출 버튼을 클릭하면

angular.module('ngBoilerplate.about', [ 
    'ui.router', 
    'placeholders', 
    'ui.bootstrap', 
    'mgo-angular-wizard' 
]) 

.config(function config($stateProvider) { 
    $stateProvider.state('about', { 
     url: '/about', 
     views: { 
      "main": { 
       controller: 'AboutCtrl', 
       templateUrl: 'about/about.tpl.html' 
      } 
     }, 
     data: { pageTitle: 'What is It?' } 
    }); 
}) 

.controller('AboutCtrl', function AboutCtrl($scope) { 

    $scope.user = {}; 

    $scope.submitted = false; 

    $scope.signupForm = function() { 
     if ($scope.age_form.$valid) { 
      window.location="#/about"; 
     } else { 
     $scope.age_form.submitted = true; 
     } 
    }; 
}); 

$ scope.age_form은 정의되지 않았습니다.

아무도이 문제를 도와 줄 수 있습니까?

답장을 보내 주셔서 감사합니다.

답변

0

각도 마법사 프로젝트에는 현재 범위 지정 문제가 있습니다. 나는 그것을 아래의 게시물에서 풀 수 있었다.

폼 검증 그러나 각도 마법사
I'm trying to get form validations to work with an Angular Wizard

와 함께 작동하도록 시도, 이것은 임시 수정입니다. 프로젝트를 확실히 재 작업해야합니다.

github에서이 문제와 관련이 있습니다.

단계 확인!
https://github.com/mgonto/angular-wizard/issues/41