As my title says, i was creating a login form and following was my html. but submit button is not working.
<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>
Here is my 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>', '');
..... ...... ..... as button click was not working. i tried everything like changing giving input a type, changing ng-click to ng-submit, giving $event.stopPropagation(); with ng-click but my checkuser method not getting called. i also remived all html and only left input button but still it is not working.
<body ng-controller="AdminController">
<input type="button" class="btn btn-success" value="Log in" id="vxLogin" ng-click="CheckUser();" />
</body>
Probably you are missing the ng-app directive in your HTML,
<body ng-app="yourAppname" ng-controller="AdminController">