2016-09-04 11 views
0

私はmegaboiletplate.comを使ってプロジェクトをスケーリングしました。私はスターターパックをダウンロードしましたが、私はいくつかの問題に直面しています。開始コードをレポに入れました

this file、ログインボタンをクリックすると16行目が表示されません。ログインボタンが間違って何この

<form ng-submit="login()"> 
     <legend>Log In</legend> 
     <div class="form-group"> 
      <label for="email">Email</label> 
      <input type="email" name="email" id="email" placeholder="Email" class="form-control" ng-model="user.email" autofocus> 
     </div> 
     <div class="form-group"> 
      <label for="password">Password</label> 
      <input type="password" name="password" id="password" placeholder="Password" class="form-control" ng-model="user.password"> 
     </div> 
     <div class="form-group"><a href="/forgot"><strong>Forgot your password?</strong></a></div> 
     <button type="submit" class="btn btn-success">Log in</button> 
     </form> 

のような見解を持っています?

+0

可能な重複のapp.jsに記載されていなければならない、あなたのケースで

.when('/login', { templateUrl: 'partials/login.html', controller: 'LoginCtrl', controllerAs: 'ctrl', resolve: { skipIfAuthenticated: skipIfAuthenticated } }) 

.when('/login', { templateUrl: 'partials/login.html', controller: 'LoginCtrl', resolve: { skipIfAuthenticated: skipIfAuthenticated } }) 

に変更されるだろうhttp://stackoverflow.com/questions/39313552/ng-submit-not-triggering-in-angularjs)。同じ質問を何度も聞かないでください。 – Claies

答えて

0

コードで 'controller as'構文を使用していることを確認してください。コントローラーでthisを使用できますが、コントローラーをHTMLで再定義する必要があります。以下のような:

<body ng-controller="mycontroller as ctrl"> 

は、あなたがあなたのコントローラがそこに割り当てられている場合、あなたのルーティングを編集する必要があり

<form ng-submit="ctrl.login()"> 

https://docs.angularjs.org/api/ng/directive/ngController

のようなコントローラ機能を使用することができます。 (これは[NG-提出angularjsにトリガーない]の定型

+0

私は知っているが、定型句には、ガルプを使った後では、ビュー内にng-controllerもない。もっと深い感謝を –

+0

私は両方の場所で変更する必要がありますか? –

+1

そのうちの1つ。 htmlまたはあなたのルータ –

関連する問題