Drop down user Authentication with Angular
Drop down user Authentication with Angular
所以我有一个html页面,应该是登录页面。到目前为止,我只有一个下拉菜单和一个登录按钮。
我研究了其他方法来获得用户身份验证工作,但我的问题是:怎么可能只用一个下拉菜单,选择一个用户,然后按下"登录"键,然后登录到那个特定的用户呢?
我正在寻找ng-route, angular的定位服务,当我按下"log in"按钮时重定向。
<div class="login">
<p>Welcome to the log-in page!</p>
<!--This is where the user selects their username-->
<select>
<option value="" disabled="disabled" selected="selected">Please select a name</option>
<option value="1">userName1</option>
<option value="2">userName2</option>
</select>
<br '>
<br '>
<!--This is the login button-->
<button type="button" ng-click=""> Login </button>
</div>
编辑:我明白我的问题或至少我想做的事情似乎很模糊,但我只是想遵循一个git-hub项目,其中规定
"登录屏幕允许用户选择自己的名字。不需要输入密码。单击Login按钮将他们带到另一个屏幕。"
我只是这样做学习前端,使我的第一个web应用程序。
第二个编辑:https://github.com/archfirst/trader-desktop
这是我挑选的git hub项目。
我不知道我是否理解你的问题但是如果你只是想在用户点击" login "时重定向,你可以在ng-click指令上添加一个函数,像这样
<button type="button" ng-click="Login()"> Login </button>
在控制器中,你定义的函数只是重定向到适当的路由。像这样。
$scope.Login = function() {
$state.go(HOME_STATE);
}
HOME_STATE为日志记录后在路由上为home定义的状态。
下载angular路由器,因为它不是angular的一部分,并在angular中这样配置它
angular.module('yourAwesomeApp',['ngRoute']).config(function($routeProvider){
$routeProvider.when('login',{
templateUrl: 'login.html',
})
})
<a type="button" href="#login"> Login </a>
相关文章:
- Bootstrap scrollspy with angular-ui
- JavaScript array.push (object) with Angular ng-repeat 无法按预期运
- jQuery key event with angular
- PapaParse with Angular JS
- Jasmine Testing with Angular Promise 无法使用 TypeScript 解析
- Routing with angular and Symfony
- AngularJS - Directives with Angular UI Bootstrap
- Angularjs, e2e test with angular-recaptcha
- Facebook OG Meta with Angular and Node
- Array transformation with angular.forEach - AngularJS
- Jquery spritespin integration with angular js
- Angularjs - ng-disabled with angular.isDefined不起作用
- Middleman asset_hash with Angular templateUrl
- Oauth 2 popup with Angular 2
- Issue With Angular $scope.Watch
- Use ngAnimate with Angular-Formly (ngHide/ngShow)
- Zomato api with angular
- Issue with angular js 1.3.14
- Issue with Angular don't see my data
- 使用ng-options with angular显示带有键和值的选择选项,并设置一个默认值