2014-10-17 60 views
0

嗨,我剛學的角度,我想知道,如果有人可以讓我知道我在做什麼錯在約曼註冊頁面設置此簡單的負載吧頁面的進度條

在signup.controller.js,我有以下代碼:

'use strict'; 

angular.module('lolBetApp') 
    .controller('SignupCtrl', function ($scope, $http, Auth, $location) { 
$scope.user = {}; 
$scope.errors = {}; 

$scope.register = function(form) { 
    $scope.submitted = true; 

    if(form.$valid) { 
    Auth.createUser({ 
     summonerName: $scope.user.summonerName, 
     email: $scope.user.email, 
     password: $scope.user.password 
    }) 
    .then(function() { 
     // Account created, redirect to home 
     $location.path('/'); 
    }) 
    .catch(function(err) { 
     err = err.data; 
     $scope.errors = {}; 

     // Update validity of form fields that match the mongoose errors 
     angular.forEach(err.errors, function(error, field) { 
     form[field].$setValidity('mongoose', false); 
     $scope.errors[field] = error.message; 
     }); 
    }); 
    } 
}; 

$scope.$emit('LOAD') 
$http.jsonp('http://filltext.com/?rows=10&delay=5&fname={firstName}&callback=JSON_CALLBACK') 
.success(function(data){ 
    $scope.people=data; 
    $scope.$emit('UNLOAD') 
}); 

}). 
controller('loaderController',['$scope',function($scope){ 
    $scope.$on('LOAD',function(){$scope.loading=true}); 
    $scope.$on('UNLOAD',function(){$scope.loading=false }); 
}]); 

在我signup.html,我有以下代碼:

<div ng-controller="loaderController"> 
<div class="alert alert-info" ng-show="loading">Summoning...</div> 
<div ng-controller="myController"> 
    <ul> 
    <li ng-repeat="person in people"> 
     {{person.fname}} 
    </li> 
    </ul> 
</div> 

我能得到這個無需使用Yeom即可輕鬆工作an,使用此鏈接中的代碼http://plnkr.co/edit/30qbDj0xuBESp6LT8etM?p=info

有誰知道我在做什麼錯?

謝謝,

回答

0

沒關係!我剛剛開始工作。問題在於我在signup.html頁面中輸入了錯誤的控制器名稱

<div ng-controller="SignupCtrl"> 
    <ul> 
    <li ng-repeat="person in people"> 
     {{person.fname}} 
    </li> 
    </ul> 
</div>