AngularJS 中的登录表单 Json
Login form in AngularJS with Json
我是Angular的新人,正在研究登录表单。
我使用的模型是这样的:PLNKR。有两个问题我无法解决。
FIRST: 我不知道如何在独立页面中转换模态window。您可以在“parentController.js”中找到模态代码:
$scope.modalShown = false;
var showLoginDialog = function() {
if(!$scope.modalShown){
$scope.modalShown = true;
var modalInstance = $modal.open({
templateUrl : 'login.html',
controller : "LoginCtrl",
backdrop : 'static',
});
modalInstance.result.then(function() {
$scope.modalShown = false;
});
}
};
SECOND:在“login.html”文件中的登录表单中,你可以注意到用户名 div:
<div style="margin-top: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i>
</span>
<input type="text" class="form-control" name="username"
ng-model="credentials.username" placeholder="Username" required />
</div>
我如何插入一个 <select> 框而不是输入框,填充数组中的用户名(在本例中为 <select 框 "Admin, Editor, Guest")?
非常感谢!
首先:您想摆脱模型 window 吗?
第二个:ng-repeat应该
<select >
<option ng-repeat="type in userArray" value="{{type}}" >
{{type}}
</option>
</select>
我是Angular的新人,正在研究登录表单。
我使用的模型是这样的:PLNKR。有两个问题我无法解决。
FIRST: 我不知道如何在独立页面中转换模态window。您可以在“parentController.js”中找到模态代码:
$scope.modalShown = false; var showLoginDialog = function() { if(!$scope.modalShown){ $scope.modalShown = true; var modalInstance = $modal.open({ templateUrl : 'login.html', controller : "LoginCtrl", backdrop : 'static', }); modalInstance.result.then(function() { $scope.modalShown = false; }); } };
SECOND:在“login.html”文件中的登录表单中,你可以注意到用户名 div:
<div style="margin-top: 25px" class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i> </span> <input type="text" class="form-control" name="username" ng-model="credentials.username" placeholder="Username" required /> </div>
我如何插入一个 <select> 框而不是输入框,填充数组中的用户名(在本例中为 <select 框 "Admin, Editor, Guest")?
非常感谢!
首先:您想摆脱模型 window 吗?
第二个:ng-repeat应该
<select >
<option ng-repeat="type in userArray" value="{{type}}" >
{{type}}
</option>
</select>