1
正如我的標題所說,我正在創建一個登錄表單,以下是我的HTML。但提交按鈕不起作用。輸入按鈕不工作在angularjs當只有按鈕在身體有
<body ng-controller="AdminController">
<div class="container">
<section id="content">
<form action="">
<h1>Log In </h1>
<div>
<input type="text" placeholder="Username" required="" id="vxUserName" ng-model="UserName" />
</div>
<div>
<input type="password" placeholder="Password" required="" id="vxUserPass" ng-model="UserPassword" />
</div>
<div style="padding-left:10px;padding-bottom:70px;padding-top:30px">
<input type="button" class="btn btn-success" value="Log in" id="vxLogin" ng-click="CheckUser()" />
</div>
</form><!-- form -->
</section><!-- content -->
</div>
</body>
這是我的angularjs。
app.controller('AdminController', function ($scope, $http, $location, $timeout, $filter) {
var SelectedPackages = "";
$scope.ContactDetails = [];
var SelectedEnquiry = sessionStorage.getItem("_SelectedEnquiry");
$scope.setId = function (setal) {
alert(SelectedEnquiry);
};
$scope.CheckUser = function() {
alert("a");
sessionStorage.setItem("_OwnAccessCount", "0");
sessionStorage.setItem("_OwnAccessUsed", "0");
debugger;
$http.get("ws/ws_HolidayPackages.asmx/CheckUser?&_UserName=" + $scope.UserName + "&_Password=" + $scope.UserPassword)
.success(function (data) {
sessionStorage.setItem("_UserPassword", $scope.UserPassword);
var userPassword = sessionStorage.getItem("_UserPassword");
debugger;
data = data.replace('<?xml version="1.0" encoding="utf-8"?>', '');
data = data.replace('<string xmlns="http://tempuri.org/">', '');
data = data.replace('</string>', '');
..... ...... ..... 如按一下按鈕不能正常工作。我試着改變輸入類型,改變ng-click到ng-submit,給$ event.stopPropagation();用ng-click但我的checkuser方法沒有被調用。我也remived所有的HTML和只剩下輸入按鈕,但仍然無法正常工作。
<body ng-controller="AdminController">
<input type="button" class="btn btn-success" value="Log in" id="vxLogin" ng-click="CheckUser();" />
</body>
你如何決定它不工作? – Sajeetharan
我會嘗試在這裏創建和添加參考。 – VijayNarang
請發送您的Skype帳號 – VijayNarang