I am following the following link to get angular animations working in the app:
http://angularanimation.ya.com.tr/start.html
I have animate.css in my css folder and link to it in index.html.
Also, I have ngAnimate as a dependent module in app.js
I tried to use an animation in my html:
<ion-view class="slide-from-top">
<ion-content>
<div class="contentArea">
<form action="#">
<div class="row">
<label>The Italian Melt</label>
<input class="field" type="text" value="160.00">
<input class="number" type="text" value="1">
<i class="fa fa-plus-circle"></i>
<i class="fa fa-minus-circle"></i>
</div>
<div class="row">
<label>The Italian Melt</label>
<input class="field" type="text" value="160.00">
<input class="number" type="text" value="1">
<i class="fa fa-plus-circle"></i>
<i class="fa fa-minus-circle"></i>
</div>
<div class="row">
<label>The Italian Melt</label>
<input class="field" type="text" value="160.00">
<input class="number" type="text" value="1">
<i class="fa fa-plus-circle"></i>
<i class="fa fa-minus-circle"></i>
</div>
<hr>
<div class="row text">
<div class="col-33">Subtotal</div>
<div class="col-75">Rs. 210.00</div>
</div>
<div class="row text">
<div class="col-33 blueText">Discount</div>
<div class="col-75 blueText">Rs. 42.00</div>
</div>
<div class="row text">
<div class="col-33">Delivery Fee</div>
<div class="col-75">Rs. 10.00</div>
</div>
<hr>
<div class="row text">Total will refund off</div></br>
<div class="row text">
<div class="col-33 totalBig">Total</div>
<div class="col-75 totalBig">Rs. 178.00</div>
</div>
<hr>
<form action="#">
<div class="customRow">
<div class="row coupon">
<label>Coupon</label>
<input class="couponField" type="text">
<button class="applyBtn">Apply</button>
</div>
</div>
</form>
<p class="row redText">Minimum Order : Rs. 500/-</p>
</div>
<button class="button-checkout">Proceed to Checkout <i class="fa fa-shopping-cart"></i> >></button>
</ion-content>
</ion-view>
Infact, when I go to console,
I see this:
How do I get it working?
Pleas check https://daneden.github.io/animate.css/
Dynamic Animation
You have to call animation function like
<ion-view class="myAnimation">
<ion-content>
....
</ion-content>
</ion-view>
and add class when page is loaded
$('#myAnimation').addClass('animated shake');
and after animation finish you have to remove class which is added to div so again animation works without refresh page. for that you have to do that
$('#myAnimation').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', removeClass);
function removeClass()
{
$('#myAnimation').removeClass('animated shake');
}
This way is dynamic but you can also set as static in html like
Static
<ion-view class="animated shake">
<ion-content>
....
</ion-content>
</ion-view>
Related
I'm doing a system to idle a user after 1 minute and I'm opening a modal with a button to alert the user with a button inside which redirects to login page.
controllerScope.logout = function () {
alert("logout");
$location.path('/');
AuthService.logout(controllerScope.user).then(function (result) {
$state.go('user.signin');
});
};
In my view:
<script type="text/ng-template" id="timedout-dialog.html">
<div class="modal-header">
<h3>Oh, Snap! You've Timed Out!</h3>
</div>
<div class="modal-body">
<p>
You were idle too long. Click the button below to be redirected to the login page and begin again.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-small" ng-click="doLogout()">Back To Login</button>
</div>
</script>
Why when I click on my "back to login" on modal it doesn't go to my function on the controller? I tried to pop up an alert, a simple thing but event that doesn't work
You need to make below changes, since you use controller as syntax :
In controller it should be like var controllerScope = this
In HTML controller declaration be like : ng-controller ="yourcontrollername as controllerScope"
During calling logout, it should be like ng-click="controllerScope.logout()"
Update
Your plunker has many issues, this even doesn't run angular.
So I created this Fiddle with minimal possible code to show the things to be done.
In general :
use controller as alias., for logout ng-click="inventoryCtrl.openNewDeviceModal()" and for opening modal popup use alias as well controller: 'InventoryController as inventoryCtrl',
You set doLogout() function into your ng-click. Would you mean logout() as in your controller ?
Your ng-click method is wrongly called: Kindly change ng-click="controllerScope.logout()"> instead of ng-click="doLogout()">
Update
I have uploaded my code to share with you https://jsfiddle.net/y0xrgjaf/
Your template code in outside of the controller div tag. You should add your all html code inside of the main div
<div ng-controller="controllername">
//all code should be here
</div>
Copy this below code and paste it
<div class="row" ng-controller="InventoryController as inventoryCtrl" >
<div class="col-md-12">
<div class="panel mb25">
<div class="panel-body">
<table class="table mb0 table-striped datatable" ui-jq="dataTable" ui-options="devicesData">
<thead>
<tr>
<th></th>
<th>S/N</th>
<th>IP</th>
<th>Name</th>
<th>Manufacturer</th>
<th>Model</th>
<th>Organization</th>
<th style="width:70px;"></th>
</tr>
</thead>
</table>
</div>
</div>
<div>
<button class="btn btn-default" ng-click="openNewDeviceModal()">Add Device</button>
</div>
</div>
<script type="text/ng-template" id="newDeviceModalContent.html">
<div class="modal-header">
<h3 class="modal-title" ng-bind="deviceModalTitle"> Add Device</h3>
</div>
<div class="modal-body">
<form class="form-horizontal bordered-group" role="form" name="addDeviceForm">
<div class="form-group">
<label class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" ng-model="newdevice.data.name" required>
<span ng-show="addDeviceForm.name.$invalid">The name is required.</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">S/N</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="sn" ng-model="newdevice.data.sn" required>
<span ng-show="addDeviceForm.sn.$invalid">The S/N is required.</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Model</label>
<div class="col-sm-10">
<select class="form-control" ng-model="newdevice.device_type_id" ng-options="type.id as type.model for type in deviceTypes">
<option value="">None</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Organization</label>
<div class="col-sm-10">
<select class="form-control" ng-model="newdevice.organization_id" ng-options="organization.id as organization.data.name for organization in organizations">
<option value="">None</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default btn-sm" ng-click="saveDevice()" ng-disabled="addDeviceForm.name.$invalid || addDeviceForm.sn.$invalid">Save</button>
<button class="btn btn-default btn-sm" ng-click="cancel()">Cancel</button>
</div>
</script>
<script type="text/ng-template" id="timedout-dialog.html">
<div class="modal-header">
<h3>Oh, Snap! You've Timed Out!</h3>
</div>
<div class="modal-body">
<p>
You were idle too long. Click the button below to be redirected to the login page and begin again.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-small" ng-click="inventoryCtrl.logout()">Back To Login</button>
</div>
</script>
</div>
Hello I am new in ionic app and I created a first page using following:->
<ion-modal-view>
<ion-view id ="login" hide-nav-bar="true">
<ion-content scroll="false">
<div id="login_image" >
<div class="header padding text-center logodata">
<img src="img/front-logo.png" alt="Your logo here" width="60%" height="auto" class="logoImage"/>
</div>
<div class="header padding text-center panda">
<img src="img/bear.png" alt="Your logo here" width="47%" height="auto"/>
</div>
<h1 class="getstarted" style="text-align:center">Get Started !</h1>
</div>
<form ng-submit="doLogin()" name="loginForm">
<div class="row responsive-md">
<div class="col col-50 col-offset-25">
<div class="list">
<label class="item item-input">
<i class="fa fa-user fa-6" aria-hidden="true"></i>
<input type="email" ng-model="loginData.username" placeholder="" required>
</label>
<label class="item item-input">
<i class="fa fa-lock fa-6" aria-hidden="true"></i>
<input type="password" placeholder="" ng-model="loginData.password" required>
</label>
<button class="button button-block button-positive sign_in" type="submit" ng-disabled="loginForm.$invalid">
SIGN IN
</button>
<div class="signup"><center class="insignup"><span class="donaccount">Don't have an account ?</span> <a href ng-click= "dashBoard()" class="achorsignup"> SIGN UP</a></center><div>
</div>
</div>
</div>
</form>
</ion-content>
</ion-view>
</ion-modal-view>
then I see the design in virtual device means in my laptop it look properly by scrolling
But When I run in android phone it look like this no scroll option is showing how to see full home page in android phone
ion-Scroll Can be used in places where you may not need a full page scroller, but a highly customized one, such as image scubber or comment scroller.
<ion-scroll scrollX="true">
</ion-scroll>
<ion-scroll scrollY="true">
</ion-scroll>
<ion-scroll scrollX="true" scrollY="true">
</ion-scroll>
More info refer this
You have to set the value of scroll attribute to true if you want to make the page scroll.
<ion-content scroll="true">
Hope this helps!
I have a form with some contents and some buttons. What I want to do is by clicking a button, hide the original contents of the form and load some new contents. Now I have done the hiding part using ng-show . But i'm stuck at loading new contents using ng include. I have included the contents that I want to show inside script tags and tried to load on button click.
This is what I have done.
<!DOCTYPE html>
<html lang="en">
<div class="container">
<form role="form" id="info_form" name="info_form" ng-controller="infoCtrl" ng-app="app" novalidate>
<section class="content-header">
<h1>
Fill your medical information
<!--<small>Optional description</small>-->
</h1>
</section>
<!-- Main content -->
<section class="content">
<div class="box">
<div class="box-body" ng-show="table_remove" >
<div>
<div class="col-lg-12">
<div style="margin-top: 15px;width: 100%;">
<!--first block-->
<div style="float: left;width: 33%;height: 100%">
<div class="form-group">
<label class="info_ques_text">Maximum Heart Rate</label>
<div class="input-group">
<input class='input' type="number" name="Heart" id="Heart" class="form-control" ng-model="data.heart_rate" placeholder="Enter Value" required><br>
<span class="error_msg" ng-show="submitted && info_form.Heart.$error.required">Value cannot be blank</span>
</div>
</div>
</div>
<!--third block-->
<div class="form-group">
<label class="info_ques_text">How Long Do You Work Per Day?</label>
<div class="input-group">
<select class='input' name="Work" id="Work" ng-model="data.work" ng-selected="" required>
<option value="" disabled selected>Select Your Option</option>
<option value="0">4-5 Hours</option>
<option value="1">5-6 Hours</option>
<option value="2">6-7 Hours</option>
<option value="3">More than 7 Hours</option>
</select><br>
<span class="error_msg" ng-show="submitted && info_form.Work.$error.required">Value cannot be blank</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer" ng-show="table_remove">
<button href="" type="submit" ng-click="submitted = true; train(data);" class="btn btn-primary">Train data</button>
<button href="" type="submit" ng-click="submitted = true; submit(data); template = 'predictview'" class="btn btn-primary">Submit</button>
<a type="button" class="btn btn-danger" href="{{url()}}/admin/organizations/view">Cancel</a>
</div>
</div>
<ng-include src="template"></ng-include>
<script type="text/ng-template" id="predictview">
<div class="container" ng-controller="questionEditCtrl" >
<form class="form-horizontal" role="form" name='quizAdd' ng-submit="submit(data2)">
<a> New page </a>
</form>
</div>
</script>
</section><!-- /.content -->
</form>
</div>
</html>
I have problem with ng-repeat when i search for a car its done but i delete the name i searched for the cars doesn't back to the view this is my html:
<ion-content lazy-scroll ng-class="{expanded:isExpanded}">
<div class="item-input-inset bar-light">
<label class="item-input-wrapper">
<i class="icon ion-search placeholder-icon"></i>
<input type="search" ng-model="query" placeholder="Search">
</label>
</div class="content has-header">
<div>
<div class="list animate-fade-slide-in-right">
<a class="item item-thumbnail-left item-icon-right" ng-repeat='item in voitures[0] | filter: query' ng-model="data" ng-click="getID(item)" ui-sref="app.detailsVoiture({Id: item.idVoiture})">
<img image-lazy-src="img/{{item.photo}}.jpg" image-lazy-loader="android" image-lazy-distance-from-bottom-to-load="-200" image-lazy-distance-from-right-to-load="-200">
<h2 class="border-top" style="color:blue;">{{item.Modele.marque}} {{item.Modele.nom}}</h2>
<p >{{item.categorie}}</p>
<i class="icon ion-pricetag energized-900">{{item.prixLocation}}</i>
</a>
</div>
</div>
</ion-content>
MY issue is this:
When I request the data from the server this sent the data correctly but in LoginController after doing the validation I'm trying to populate the user's username and email but those variables are not being printed in the template. However if I just send those variables in a simple JSON such as $scope.details = [{ 'username':'Karman', 'username':'karman#mail.com'}]; it's working fine, what am I doing wrong? Is there some issue with ng-repeat directive?
Thanks in advance to whom can help me out with this issue.....
ps: I'm using sillex and ng-resource just in case
<body ng-controller="LoginController">
<div class="col-xs-3 details-user">
<div class="col-xs-1">
<img src="web/img/avatar.jpg" alt="..." class="img-circle">
</div>
<div class="col-xs-2">
<ul>
<li ng-repeat="detail in details">
{{detail.username}} -- {{detail.email}}
</li>
</ul>
</div>
</div>
Controller:
function LoginController($scope, Login) {
var currentResource;
$scope.login = function () {
Login.query({email: $scope.email}, function success(data){
$scope.details = data;
//$scope.details = [{ 'username':'Karman', 'username':'karman#mail.com'}];
});
}
}
Form:
<!-- Main DIV -->
<div id="login" class="login-main">
<div class="form-wrap">
<div class="form-header">
<i class="fa fa-user"></i>
</div>
<div class="form-main">
<form>
<div class="form-group">
<input ng-model="email" type="text" class="input-large" placeholder="Tu email aqui..." required>
<input ng-model="password" type="password" class="input-large" placeholder="Tu password aqui..." required>
</div>
<button ng-click="login()" ng-show='addMode' class="btn btn-success">Sign In</button>
</form><!-- end form -->
</div><!-- end div form-main -->
<div class="form-footer">
<div class="row">
<div class="col-xs-7">
<i class="fa fa-unlock-alt"></i>
Forgot password?
</div>
<div class="col-xs-5">
<i class="fa fa-check"></i>
Sign Up
</div>
</div>
</div>
</div>
</div>