比方说,我有一个用户密码为te/st。 而这个标记:密码字段从密码中删除'/'字符
<input type="password" class="form-control" placeholder="Password" ng-model="password" required>
<button class="btn btn-lg btn-primary btn-block" type="submit" ng-click="login(username, password)">Sign in</button>
不知何故,包含在NG-模型中的价值变得测试 这究竟是为什么?
在控制器的方法:
$scope.login = function (username, password) {
console.log("pass:", password);
authService.login(username, password).then(function() {
console.log("auth success. username: ", username);
},
function() {
notifications.showError("Login failed!");
});
};
究竟你是如何TE /刺痛呢? – deceze
看到控制器也是必要的 –
如何调用'login'函数?它使用参数'password'而不是'$ scope.password'。我只是在这里猜测,因为你没有共享完整的代码 –