我的问题是:
当我从服务器请求数据时,这会正确地发送数据,但在执行验证后LoginController
我尝试填充用户的用户名和电子邮件,但这些变量不是打印在模板中。但是,如果我只是在一个简单的JSON中发送这些变量,例如$scope.details = [{ 'username':'Karman', 'username':'karman@mail.com'}];
它工作正常,我做错了什么? ng-repeat指令有问题吗?
先谢谢谁可以帮我解决这个问题......
ps:我使用sillex和ng-resource以防万一
<body ng-controller="LoginController">
<div class="col-xs-3 details-user">
<div class="col-xs-1">
<img src="web/img/avatar.jpg" alt="..." class="img-circle">
</div>
<div class="col-xs-2">
<ul>
<li ng-repeat="detail in details">
{{detail.username}} -- {{detail.email}}
</li>
</ul>
</div>
</div>
控制器:
function LoginController($scope, Login) {
var currentResource;
$scope.login = function () {
Login.query({email: $scope.email}, function success(data){
$scope.details = data;
//$scope.details = [{ 'username':'Karman', 'username':'karman@mail.com'}];
});
}
}
形式:
<!-- Main DIV -->
<div id="login" class="login-main">
<div class="form-wrap">
<div class="form-header">
<i class="fa fa-user"></i>
</div>
<div class="form-main">
<form>
<div class="form-group">
<input ng-model="email" type="text" class="input-large" placeholder="Tu email aqui..." required>
<input ng-model="password" type="password" class="input-large" placeholder="Tu password aqui..." required>
</div>
<button ng-click="login()" ng-show='addMode' class="btn btn-success">Sign In</button>
</form><!-- end form -->
</div><!-- end div form-main -->
<div class="form-footer">
<div class="row">
<div class="col-xs-7">
<i class="fa fa-unlock-alt"></i>
<a href="" id="forgot_from">Forgot password?</a>
</div>
<div class="col-xs-5">
<i class="fa fa-check"></i>
<a href="" id="signup_from">Sign Up</a>
</div>
</div>
</div>
</div>
</div>