Angularjs 登录应用程序不工作
这是我在Angular中的第一个应用程序。我不知道为什么它不起作用Angularjs 登录应用程序不工作,angularjs,Angularjs,这是我在Angular中的第一个应用程序。我不知道为什么它不起作用 <body ng-controller="LoginController"> <div name="signIn" class="box-content"> <div class="box-top-content"> <label>Username:</label><input type="text" ng-model="username
<body ng-controller="LoginController">
<div name="signIn" class="box-content">
<div class="box-top-content">
<label>Username:</label><input type="text" ng-model="username" /></br>
</br> <label></label>Password:</label><input type="password" ng-model="password"></br>
<button type="submit" ng-click="submit()">login</button>
</div>
当我点击提交按钮时,什么也没发生。没有错误消息。此代码有什么问题?您需要在工厂内返回对象:
loginApp.factory('authFactory',function($http){
var authFactory ={};
authFactory.login = //...
return authFactory; //Here it is
});
为了完成并进一步解释该返回发生了什么,下面是对显示模块模式的一个很好的解释:
loginApp.factory('authFactory',function($http){
var authFactory ={};
authFactory.login = //...
return authFactory; //Here it is
});