gpt4 book ai didi

javascript - Angular JS 中的按钮单击事件

转载 作者:行者123 更新时间:2023-12-03 08:59:40 25 4
gpt4 key购买 nike

我正在尝试在 Angular Js 中触发按钮单击事件,但它根本没有发生。我在 Chrome 开发者控制台中也没有收到任何与事件相关的错误。这是标记..

                    <!-- Login Form Here !-->

<div id="login" ng-controller="LoginformController" style="display: none;" class="col-sm-5 form-box">
<div class="form-top">
<div class="form-top-left">
<h3>Login now</h3>
<p>Fill in the form below to get instant access:</p>
</div>
<div class="form-top-right">
<i class="fa fa-pencil"></i>
</div>
<div class="form-top-divider"></div>
</div>
<div class="form-bottom">
<form role="form" action="" method="post" class="registration-form">
<div class="form-group">
<label class="sr-only" for="UserID">User ID</label>
<input type="text" name="UserID" placeholder="User ID..." class="form-first-name form-control" id="UserID">
</div>
<div class="form-group">
<label class="sr-only" for="Password">Password</label>
<input type="text" name="Password" placeholder="Password..." class="form-last-name form-control" id="Password">
</div>

<button type="submit" class="btn">Login!</button>
<br/>
<button type="button" class="btn-sm btn-link" ng-click="PasswordRecovery()">Forgot Password</button>

</form>
</div>
</div>

这是 anguar JS 代码..

  var app = angular.module('LoginApp', []);
app.controller('LoginformController', function ($scope) {
$scope.PasswordRecovery = function () {
alert("Clicked 2");

}
});

请帮我解决这个问题..

最佳答案

如果我添加

<div ng-controller="UnexistingController"></div>

到你的 HTML 然后我会得到:

"Error: [ng:areq] Argument 'UnexistingController' is not a function, got undefined http://errors.angularjs.org/1.4.3/ng/areq?p0=UnexistingController&p1=not%20a%20function%2C%20got%20undefined

这是有道理的,因为我还没有向模块添加 Controller 。我怀疑你犯了同样的错误。

Argument 'SignupformController' is not a f‌​unction, got undefined

Description

AngularJS often asserts that certain values will be present and truthy using a helper function. If the assertion fails, this error is thrown. To fix this problem, make sure that the value the assertion expects is defined and truthy

.

关于javascript - Angular JS 中的按钮单击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32347893/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com