I have such a problem:
Firebase authentication working in computer, android devices and iphone 4, 6.
But no work on iphone 5. When click enter, nothing happens.
What can be?
Thank you very much.
component.ts
onLogin(){
let data = {
email: this.user.email,
password: this.user.password
}
this.af.auth.login(data).catch(function(error){
});
}
component.html
<form #f="ngForm" (ngSubmit)="onLogin()">
<div class="form-group">
<md-input-container class="full-width">
<input mdInput name="email" type="email" required placeholder="Email" [(ngModel)]="user.email">
</md-input-container>
</div>
<div class="form-group">
<md-input-container class="full-width">
<input mdInput name="password" type="password" required placeholder="password" [(ngModel)]="user.password">
</md-input-container>
</div>
<div class="form-group">
<button md-raised-button type="submit">enter</button>
</div>
</form>
I developed the following login page in Ionic:
<form name="login_form" class="form-container" novalidate>
<div class="byf-logo">
<img src="img/logo-text-clear-transparent.png" />
</div>
<div class="list list-inset byf-login-form">
<label class="item item-input">
<img src="img/icons/person.png" alt="">
<input type="email" placeholder="Email" ng-model="user.email" required>
</label>
<label class="item item-input">
<img src="img/icons/locker.png" alt="">
<input type="password" placeholder="Password" ng-model="user.password" required>
</label>
<button class="button button-block button-assertive" ng-click="login(user)" ng-disabled="login_form.$invalid">CONNEXION</button>
</div>
</form>
<div ng-show="error">
<p class="message error"><i>{{error}}</i></p>
</div>
I expect the form to be sliding up a little when the password input (second input) is in focus because keyboard overlaps it:
It works perfectly in another page without writing any particular code so I guess it is default behavior.
Any idea why it doesn't slide here ?
I had this same problem and the only way i could get it to work was as follows
this.keyboard.onKeyboardShow().subscribe(e => {
console.log('Keyboard height is: ' + e.keyboardHeight);
jQuery('body').animate({ 'marginTop': - e.keyboardHeight + 'px' }, 200);
});
this.keyboard.onKeyboardHide().subscribe(e => {
jQuery('body').animate({ 'marginTop': 0 + 'px' }, 200);
});
I am getting some issue while working with ionic framework. I am trying to work on Grocery app Where user can add items. The code which I have written doesn't work showing "undefined" with blank field and But when I replace "ion-content" tag with "div" tag then My code works fine. I am confused why is this happening? Please help Thanks.
<ion-content>
<div class="grocery-wrapper">
<ion-item ng-repeat="groceryItem in groceryItems">
<div class="row">
<div class="col col-20">
<label class="checkbox checkbox-balanced">
<input class="checkbox" type="checkbox"/>
</label>
</div>
<div class="col col-33 g-items">{{groceryItem.itemName}}</div>
<div class="col g-items">{{groceryItem.Quantity}}</div>
<div class="col g-items">{{groceryItem.Rate}} rs/kg</div>
</div>
</ion-item>
<div id="getGroceryItem" ng-show="GroceryItem">
<div class="row">
<div class="col col-50">
<label class="item item-input item-floating-label">
<span class="input-label">Grocery Item</span>
<input ng-model="gItem" type="text" placeholder="Grocery Item">
</label>
</div>
<div class="col">
<label class="item item-input item-floating-label">
<span class="input-label">Kg</span>
<input ng-model="gKg" type="text" placeholder="kg">
</label>
</div>
<div class="col">
<label class="item item-input item-floating-label">
<span class="input-label">Price</span>
<input ng-model="gPrice" type="text" placeholder="Price">
</label>
</div>
</div>
<div class="row">
<button class="button button-block button-balanced button-medium" ng-click="addGroceryItem()">
ADD ITEM
</button>
</div>
</div>
</div>
</ion-content>
app.controller('getGrocery', function($scope){
//console.log("Grocery Items");
$scope.groceryItems = [
{
'itemName':'Rice',
'Quantity':'5kg',
'Rate':'50'
},
{
'itemName':'Wheat',
'Quantity':'6kg',
'Rate':'44'
}
];
//Hide show elemment
$scope.GroceryItem = false;
$scope.addGroceryItem = function() {
//$scope.groceryObj = {};
$scope.groceryItems.push(
{
itemName:$scope.gItem,
Quantity:$scope.gKg,
Rate:$scope.gPrice
}
);
console.log($scope.gItem)
console.log($scope.gKg)
console.log($scope.gPrice)
$scope.gItem = "";
$scope.gKg = "";
$scope.gPrice = "";
}
})
http://i.stack.imgur.com/1at2T.png
As per reference http://jimhoskins.com/2012/12/14/nested-scopes-in-angularjs.html
Angular Scopes and Prototypes.
AngularJS will often create child scopes inside of directives, for the same reasons we saw above: it allows a directive to have it’s own space for key/value pairs, without messing with higher level data. Child scopes inherit from parent scopes using prototypal inheritance. (There is an exception for isolated scopes);
But we often do want to transparently write to a higher level scope, and this is where the “dot rule” comes in. Let’s see how that is applied.
Do not do this
// Controller
$scope.gItem = "Test"
// HTML
<input ng-model="gItem">
That is bad because we can’t write to it from a child scope, because a child scope uses prototypal inheritance. Once you write to gItem from a child scope, it would become a distinct value in that child scope, and no longer refer up to the parent’s gItem.
Instead, do this
// Controller
$scope.newItem = {
gItem: "",
gKg: "",
gPrice: "",
}
// HTML
<input ng-model="newItem.gItem">
The difference is we are not storing the data directly on the scope. Now when ng-model wants to write, it actually does a read, then write. It reads the newItem property from the scope, and this will work from a child scope because a child scope will search upwards for a read. Once it finds newItem, it writes to newItem.gItem, which is no problem. It just works
Index.html should be
<body ng-app="grocery">
<ion-pane ng-controller="getGrocery">
<ion-header-bar class="bar bar-header bar-assertive">
<h1 class="title text-center">Grocery</h1>
<button class="button" ng-click="GroceryItem=!GroceryItem" ng-class="{active:GroceryItem}">
<i class="icon ion-android-add"></i>
</button>
</ion-header-bar>
<ion-content class="grocery-wrapper">
<ion-list>
<ion-item ng-repeat="groceryItem in groceryItems">
<div class="row">
<div class="col col-20">
<label class="checkbox checkbox-balanced">
<input class="checkbox" type="checkbox"/>
</label>
</div>
<div class="col col-33 g-items">{{groceryItem.itemName}}</div>
<div class="col g-items">{{groceryItem.Quantity}}</div>
<div class="col g-items">{{groceryItem.Rate}} rs/kg</div>
</div>
</ion-item>
<ion-item id="getGroceryItem" ng-show="GroceryItem">
<div class="row">
<div class="col col-50">
<label class="item item-input item-floating-label">
<span class="input-label">Grocery Item</span>
<input ng-model="newitem.gItem" type="text" placeholder="Grocery Item">
</label>
</div>
<div class="col">
<label class="item item-input item-floating-label">
<span class="input-label">Kg</span>
<input ng-model="newitem.gKg" type="text" placeholder="kg">
</label>
</div>
<div class="col">
<label class="item item-input item-floating-label">
<span class="input-label">Price</span>
<input ng-model="newitem.gPrice" type="text" placeholder="Price">
</label>
</div>
</div>
<div class="row">
<button class="button button-block button-balanced button-medium" ng-click="addGroceryItem()">
ADD ITEM
</button>
</div>
</ion-item>
</ion-list>
</ion-content>
</ion-pane>
app.js should be
app.controller('getGrocery', function($scope){
//console.log("Grocery Items");
$scope.groceryItems = [
{
'itemName':'Rice',
'Quantity':'5kg',
'Rate':'50'
},
{
'itemName':'Wheat',
'Quantity':'6kg',
'Rate':'44'
}
];
//Hide show elemment
$scope.GroceryItem = false;
$scope.newitem = {
gItem: "",
gKg: "",
gPrice: "",
}
$scope.addGroceryItem = function() {
//$scope.groceryObj = {};
console.log($scope.newitem.gItem)
console.log($scope.newitem.gKg)
console.log($scope.newitem.gPrice)
$scope.groceryItems.push(
{
itemName:$scope.newitem.gItem,
Quantity:$scope.newitem.gKg,
Rate:$scope.newitem.gPrice
}
);
$scope.newitem = {
gItem: "",
gKg: "",
gPrice: "",
}
}
});
I have a login page. Its fixed now, but I want to enable scroll when I focus on any of one text box. How to do it?
<ion-view>
<ion-content class="background">
<div class="loginscreen">
<div class="row">
<div class="col-80 col-offset-10">
<div class="appheader-frame">
<span>
<img src="img/clock.png" alt="clock" class="clockwidth"></img>
</span>
<h1 class="timesheettext">
<b>Timesheet Tracking</b>
</h1>
</div>
</div>
</div>
<div class="row">
<div class=" formpadding col-80 col-offset-10">
<form novalidate name="loginForm" ng-submit="doLogin(loginForm)">
<label class="item item-input labelusername">
<i class="icon placeholder-icon"><img src="img/user.png" alt="" style="width:20px;height:20px;"/></i>
<input name="UserName" type="text" ng-model="User.UserName" placeholder="Username or Email" ng-focus="hidefooter()" required>
</label>
<p ng-show="loginForm.UserName.$error.required && loginSubmitted" class="usernameerror">
Please provide username
</p>
<label class="item item-input labelpassword">
<i class="icon placeholder-icon"><img src="img/password.png" alt="" style="width:20px;height:20px;"/></i>
<input type="password" name="password" id="password" ng-model="User.Password" placeholder="Password" ng-focus="hidefooter()" required>
</label>
<p ng-show="loginForm.password.$error.required && loginSubmitted" class="usernameerror">
provide Password
</p>
<p ng-show="myflag">
wrong credentials
</p>
<button class="button button-block button-lightgreen" type="submit">
<p class="login">
<b>submit</b>
</p>
</button>
</form>
</div>
</div>
</div>
<div class="bar bar-footer bar-inherit myfooter hide-on-keyboard-open">
<div class="title">
<p id="footer" class="byxyz" ng-show=footerflag>By xyz Software Pvt Ltd</p>
</div>
</div>
</ion-content>
</ion-view>
Is that possible in ionic framework? Then how to do it? Please explain.And don't remove anything in the page and don't add anymore details to make it scroll.I simply want to enable scroll in it but the page should be same as it is right now
simply added overflow-scroll="false" in ion-content.
<ion-content class="background" overflow-scroll="false" >
//code
</ion-content>
I have a submit form, when I click on the button "log in" it works, $_POST['login'] contains something, but when I press ENTER key it is empty.
form
<form class="form-vertical login-form" action="conexio.php" method="post">
<h3 class="form-title">Login to your account</h3>
<div class="alert alert-error hide">
<button class="close" data-dismiss="alert"></button>
<span>Enter any username and password.</span>
</div>
<div class="control-group">
<!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
<label class="control-label visible-ie8 visible-ie9">Username</label>
<div class="controls">
<div class="input-icon left">
<i class="icon-user"></i>
<input class="m-wrap placeholder-no-fix" type="text" autocomplete="off" placeholder="Username" name="username"/>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label visible-ie8 visible-ie9">Password</label>
<div class="controls">
<div class="input-icon left">
<i class="icon-lock"></i>
<input class="m-wrap placeholder-no-fix" type="password" autocomplete="off" placeholder="Password" name="password"/>
</div>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn blue pull-right" name="login">
Login <i class="m-icon-swapright m-icon-white"></i>
</button>
</div>
</form>
Try replacing <button> with <input type='submit'>.