this is my login form:
<div class="container login">
<h2 class="header">Login</h2>
<form class="form-horizontal" role="form" name="loginForm">
<div class="form-group">
<label for="inputUsername" class="col-sm-2 control-label">Username</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputUsername" placeholder="Username" ng-model="data.userName" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword" placeholder="Password" ng-model="data.password" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" ng-model="data.rememberMe"> Remember me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<a ui-sref="forgotPassword">Forgot your password?</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" ng-click="login(loginForm)" ng-disabled="loading">Sign in</button>
<span class="glyphicon glyphicon-refresh glyphicon-refresh-animate login-refresh" ng-show="loading"></span>
</div>
</div>
</form>
</div>
as you can see the last span has an animation that will be triggered when the form is being sent
this is the css:
.glyphicon-refresh-animate {
-animation: spin 1s infinite linear;
-webkit-animation: spin2 1.5s infinite linear;
}
#-webkit-keyframes spin2 {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
The problem is that when i set the $scope.loading back to false it will only hide the loading span after it finishes its animation round.
so lets say i change the animation time to 20 seconds, it will only hide the loading after something between 0-20 seconds (depending on the last run).
why is this happening?
Perhaps using ng-if instead of ng-show would fix this. ng-show merely shows and hides a DOM element, essentially toggling the "display" CSS attribute. Maybe this isn't enough to stop your animation. ng-if on the other hand doesn't even read the DOM element. It works as if the element doesn't exist in the HTML.
ngAnimate will wait until the animation has completed before hiding it.
You can prevent this by explicitly setting the animation to none:
.glyphicon-refresh-animate.ng-animate {
-webkit-animation: none 0s;
animation: none 0s;
}
Related
I am using bootstrap 3.4.1 and i am trying to extend a textbox (input) filed to full width inside of a form and i am using bootstrap grid system columns to do this but it seems it not working.. the issue is when i give col-md-12 then column it self take full width but text box is not..when i put style="max-width=100%" inside of textbox then it take full width but its not responsive.. any help is much appreciated. i have attached some pics.
my code:
<div class="row" style="border: 5px solid red;">
<div class="col-sm-12" style="border: 5px solid green;">
<div class="form-group">
<label for="AssetTagId" class="control-label">Asset Tag Id1</label>
<div>
<input type="text" class="form-control" name="AssetTagId" id="AssetTagId" ng-model="asset.AssetTagId" ng-maxlength="32" required style="border: 5px solid pink;"/> <!--style="max-width: 100%"-->
<span class="text-danger" ng-show="(frmAddAsset.AssetTagId.$touched || frmAddAsset.AssetTagId.$dirty) && frmAddAsset.AssetTagId.$invalid">
<span ng-show="frmAddAsset.AssetTagId.$error.required">AssetTagId is required</span>
<span ng-show="frmAddAsset.AssetTagId.$error.maxlength">AssetTagId must be less than or equal to 32</span>
</span>
</div>
</div>
</div>
Interface
<div class="row">
<div class="col-md-12">
<form asp-action="Create" method="post" enctype="multipart/form-data">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="PageTitle" class="control-label"></label>
<input asp-for="PageTitle" class="form-control" />
<span asp-validation-for="PageTitle" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</form>
</div>
</div>
<div class="panel-footer">
<div class="form-group">
<a asp-action="Index">Back to List</a>
</div>
</div>
I want to show the div which has Turn On E-Verify when clienId has a value if not I want to show the div which has Turn Off E-verify. I am not getting any errors but always the second div shows up and the button won't work. What am I doing wrong?
HTML :
<div class="col-md-12 col-centered" ng-app="CompanyEVerify">
<div class="row" ng-controller="EVerifyOptionController">
<form name="EverifyForm" id="EVerifyForm" class="form-horizontal" role="form" novalidate ng-submit="EVerifyForm.$valid && submit()"
style="background-color: #F0F0F0; border-radius: 8px; padding-top: 10px; margin: 15px !important;">
<div class="alert alert-danger" id="messages" style="display:none">{{message}}</div>
<div class="form-horizontal">
<input type="hidden" ng-model="company.Id" />
<div class="row">
<div class="col-md-12">
<div style="font-size:20px;font-weight:bold;display:inline-block">Would you like to opt for E-Verify feature?</div>
<br />
<div >
<div class="row" ng-if="clientId">
<div class="col-xs-12 form-group">
<label class="control-label col-xs-2">Client ID</label>
<div class="col-xs-7">
<input type="text" name="clientID" class="form-control input-md" ng-model="clientID" />
</div>
<button type="button" class="btn btn-success col-xs-3" ng-click="saveEverifyOption(clientID)">
<i class="fa fa-spinner fa-pulse"></i> Turn On E-Verify
</button>
</div>
</div>
<div class="row" ng-if="!clientId">
<div class="col-xs-12 form-group">
<label class="control-label col-xs-2">Client ID</label>
<div class="col-xs-7">
<input type="text" name="clientID" class="form-control input-md" ng-model="clientID" />
</div>
<button type="button" class="btn btn-danger col-xs-3" ng-click="saveEverifyOption(clientID)">
<i class="fa fa-spinner fa-pulse"></i> Turn Off E-Verify
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
In my controller :
$scope.clientId= sessionStorage.clientId;
I am going to assume that your controller is properly evaluating your conditions. In which case you would use ng-class to bind to css classes. I am not sure If you are trying to hide/show or disable toggle. Going with show/hide, you can make a class:
.hide{
display:none;
}
On one of your elements:
<button ng-class="{'hide': clientId}" ></button>
On the other element:
<button ng-class="{'hide': !clientId}" ></button>
Now the hide property on both elements is bound to one single source.
Check out docs example
<form name="LPform">
<div class="form-row clearfix">
<label class="lbl-fld" style="margin-left: 12%;">Email ID</label>
<input class="mob-adj-inpbx" type="email" name="uemail" ng-model="useremail" placeholder=" me#example.com" ng-required="true"/>
<div ng-show="LPform.uemail.$valid">Enter a valid email.</div>
</div>
</form>
Here, I'm adding validations to 'email' and trying to display error message only when the user enters invalid email. However this is not working.
I suppose you want to show the error message if the input is invalid so
ng-show="!LPform.uemail.$valid"
Maybe you forgot to bind it to a scope variable? cause it seems to work fine.
function Ctrl($scope) {
$scope.useremail = '';
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
<div ng-app>
<div ng-controller="Ctrl">
<form name="LPform">
<div class="form-row clearfix">
<label class="lbl-fld">Email ID</label>
<input class="mob-adj-inpbx" type="email" name="uemail" ng-model="useremail" placeholder=" me#example.com" ng-required="true" />
<div style="font-size: 11px; color: red; margin: 5px 65px;"
ng-show="!LPform.uemail.$valid">Please enter a valid email.</div>
</div>
</form>
</div>
</div>
I'm using Ionic framework to develop an app and have a view as the image shown below and I want a popup card-list to appear when the user taps on the textfields Account No: and Destination A/C:, the card-list is to be populated using a call to a web-service.
I'm a newbie to AngularJS and would appreciate if you could help me out with a basic example to get this done.
http://i.stack.imgur.com/Oh4n6.png
fundtransfer.html
<div class="list" ng-controller="PostsCtrl">
<div class="panel-heading">
<h3 class="panel-title">
Fund Transfer
</h3>
</div>
<div class="list">
<label class="item item-input item-floating-label">
<span class="input-label">Account No:</span>
<input type="text" id="accNo" name="accNo" ng-model="accNo" ng-model-options="{updateOn: 'blur'}" placeholder="Account No:">
</label>
<label class="item item-input item-floating-label">
<span class="input-label">Destination A/C:</span>
<input type="text" id="desAccNo" name="desAccNo" ng-model="desAccNo" ng-model-options="{updateOn: 'blur'}" placeholder="Destination A/C:">
</label>
<label class="item item-input item-floating-label">
<span class="input-label">Amount</span>
<input type="text" id="amount" name="amount" ng-model="amount" ng-model-options="{updateOn: 'blur'}" placeholder="Amount:">
</label>
</div>
<a class="btn btn-primary btn-block" ng-click="submit()">Transfer</a>
</div>
You could use the Ionic modal component, and override the CSS to resize if you don't want it to be full screen. It just takes a little CSS to resize the modal window, and then you can put the card component inside of the modal.
Markup
<ion-modal-view class="modal slide-in-up ng-enter active ng-enter-active">
<ion-content>
<div class="card">
...
</div>
</ion-content>
</ion-modal-view>
CSS
.modal {
width: 80%;
top: 20%;
left: 10%;
min-height: 60%;
background: none;
}
I've created a basic angular form and can't determine why it's not submitting.
http://contact-info.checkoutbiblebowl.com/
The form validation is valid and it still won't submit. I feel like I've overlooked something silly, but have looked at this over the last few days and can't figure out what it is. Any suggestions?
<form method='post' action='' name='form' novalidate ng-controller="myController">
<div class="row form">
<div class="form-inline">
<div class="form-row">
<label class="form-label" style='margin-top: 20px'>Name</label>
<div class="form-item">
<div style="float: left">
First<br/>
<input type="text" ng-model="firstName" name="firstName" class="small" style="width: 200px" maxlength="32" required>
<div ng-cloak ng-show="form.firstName.$error.required" class="required">First name is required</div>
</div>
<div style="float: left; margin-left: 1em">
Last<br/>
<input type="text" ng-model="lastName" name="lastName" class="small" style="width: 200px" maxlength="32" required>
<div ng-cloak ng-show="form.lastName.$error.required" class="required">Last name is required</div>
</div>
<div style="clear:both"></div>
</div>
</div>
<div class="button-row">
<button ng-disabled="!form.$valid" type="submit" class="btn" ng-click="debug()">Submit</button>
</div>
</div>
</div>
</form>
My Controller:
<script type="text/javascript">
angular.module('contact', []).
controller('myController', function ($scope) {
$scope.debug = function () {
console.log($scope.form);
}
});
</script>
I think you just need to specify the action explicitly, not with an empty string otherwise angular will prevent the submission.
http://docs.angularjs.org/api/ng.directive:form
like so:
http://plnkr.co/edit/WtP03BFVyEsnOqf3n8a4?p=preview