Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228532 articles
Browse latest View live

Setting Focus to an Input in Ionic

$
0
0

Hello everyone!
I don't know if any of you had this issue but after updating my project to Ionic 3.5.0 it seems like the focus and blur events are deprecated in ion-input.
these are the messages logged: "(focus) is deprecated in ion-input, use (ionFocus) instead" the same for blur.
I have a directive that makes use of the blur event so I can format the input values before send them to the server. I wouldn't want to go input by input setting the ionBlur handler (my app is full of forms).

Does any of you would know how i could implement the ionBlur in my directive?

import { Directive, HostListener, ElementRef, Attribute} from '@angular/core';
import { NgControl } from '@angular/forms';

@Directive({
	selector:'[inputFormat]'
})
export class InputFormat{
	elem:HTMLInputElement;

	constructor(
		public elRef:ElementRef,
		public control:NgControl,
		@Attribute('inputFormat') public inputFormat:string){
		this.elem = elRef.nativeElement;
	}

	capitalize(input:String){
		let preps = ['de', 'di', 'do', 'da', 'dos', 'das', 'dello', 'della', 'dalla', 'dal', 'del', 'e', 'em', 'na', 'no', 'nas', 'nos', 'van', 'von', 'y'];
	    let str = input.replace(/(^|\s)([a-z])/g, function(m, p1, p2) {
	        return p1 + p2.toUpperCase();
	    });
	    //console.log(str);
	    let arr = str.split(" ");
	    //console.log(arr);
	    for(let i = 0; i<arr.length; i++){
	        let istr = arr[i];
	        for(let j in preps){
	            if(istr.toLowerCase() == preps[j]){
	                arr[i] = preps[j];
	            }
	        }
	    }
	    str = arr.join(' ');
	    return str;
	}

	@HostListener('focus', ['$event.target.value'])
	onFocus(value){}

	@HostListener('blur', ['$event.target.value'])
	onBlur(value){
		if(value != undefined && value != ''){
			if(this.inputFormat == 'lowercase'){
				this.control.control.setValue(value.toLowerCase());
			}
			else if(this.inputFormat == 'uppercase'){
				this.control.control.setValue(value.toUpperCase());
			}
			else if(this.inputFormat == 'capitalize'){
				let val = this.capitalize(value.toLowerCase());
				this.control.control.setValue(val);
			}
		}
	}

}

My system infos:

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.12
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : ios 4.3.1
    Ionic Framework                 : ionic-angular 3.5.0

System:

    Node       : v6.5.0
    OS         : OS X El Capitan
    Xcode      : Xcode 8.1 Build version 8B62
    ios-deploy : 1.9.1
    ios-sim    : 5.0.13
    npm        : 3.10.3

thanks a lot!!


Convert string to time format

$
0
0

I have 2 strings, the first one is a time for example (06:00 am) and the second is a number between (0 and 23) and i want to compare between them.
I want to check if the start time which is a string comes from JSON is bigger or smaller than the number which comes from Range.
The first way is to convert the number to a similar format (for example if the number = 15 it will be 03:00 pm) but i can't compare the two vales because the two vales are strings not a date format.
The second way is to convert the first string to number by slicing the string and check the sliced digits.

So I need help to do one of the two ways or if there is another way.

Getting internal/fs error when trying to compile project or start new project

$
0
0

Before I blew everything away and reinstalling from scratch I just used npm itself and I got that npm -v issue and the error. When I did the reinstall I used n instead but still got all the same errors and npm -v issue.

Aside from the npm -v issue, any insights into the actual internal/fs issue?

Convert string to time format

Getting internal/fs error when trying to compile project or start new project

$
0
0

If you need sudo just to be able to access your node installation at all, it's hopelessly broken and really nothing else anybody can suggest will be of any value until you get that under control.

Convert string to time format

$
0
0

Thanks for your help, but can you give me an example for using it?

Convert string to time format

$
0
0

May I ask what work you were planning to do to solve this?

Convert string to time format

$
0
0

I explained that in the question, wasn't that clear?


A traditional way of launching an app

$
0
0

Dear All,

I have deeply analyzed the conference app. It is really a great app to understand ionic. But this app does not address all basic issues. When we launch conference app on android phones, the splash screen does not hide the status bar.
Can we make splash screen for 100% screen?
Can make a side menu in such a way that status bar should overlap the side menu. just like in play store???

dear seniors please share your experience. is it really possible to do it with ionic?

NavController cache problem

$
0
0

Excuse me, would you like to explain in detail?
The app is closed when back button is touched in Android system.
So I want to disable it.

Ionic, Crosswalk and Android Lollipop, how to handle apks?

Navigation doesn't work after third level

$
0
0

Hey all,

I built an Ionic project about a month ago with three levels of navigation - that is, from the home screen, a link brings you to a second page with a link that brings you to a third. Everything worked a month ago. However, when I came back to it today (I updated to the latest version of ionic), I found that the navigation no longer functioned on the third page.

Basically, from the home page, I click a link that takes me to page 2. Page 2 has an auto-generated back button that brings me back to the start. However, if I click on a link to take me to page 3, navigation no longer functions on that page. The auto-generated back button won't bring me back to page 2, and a function I built using the setRoot command that functioned a month ago no longer works either:

this.nav.setRoot(
	HomePage
);

I'm wondering if there's any way I can try to debug what's happening - I've been using console.log to log the NavController after running this command, and it doesn't appear that the NavController's root is modified at all.

Edit: Did some more testing - added the following code:

console.log(this.nav.getViews());
this.nav.setRoot(
	ProblemSettings
);
console.log(this.nav.getViews());

However, the console shows no change in the view stack.

Navigation doesn't work after updating to 3.5.0

$
0
0

I wouldn't do anything weird with the nav stack until maybe version 4. How about just doing this.navCtrl.push('NameOfPage'); and this.navCtrl.pop() ? Works for me.

Ionic - Dynamic forms. Formbuilder triggers after some delay and generates error

$
0
0

Thanks @rapropos . I removed ngModel and switched to ion-select. Problem gone.

best Regards. :slight_smile:

Navigation doesn't work after updating to 3.5.0

$
0
0

Maybe, but I didn't write any code for the auto-generated back button - that should still work!


Navigation doesn't work after updating to 3.5.0

$
0
0

Not if you're setting the root in weird ways.

Urgente¡¡¡ Error en ionic : 'Cannot find module '../pages/users/users'.'

$
0
0

te comparto la imagen del evento click

Just released: Tooltips Module for Ionic Apps

$
0
0

This is great! I've been using your super tabs and they're great too. Excellent stuff as usual!

Import Google Material Icon in Ionic Apps

$
0
0

Nothing seem to work with custom font when building with the latest ionic

Navigation doesn't work after updating to 3.5.0

$
0
0

I've removed that function and the generated back button still doesn't work - I don't think it's related to the root.

Viewing all 228532 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>