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

Offline Sync with MySQL

$
0
0

Helo renzz have you been able to achieve that? am having the same problem


Refactoring: Object in provider need to define in conmponent?

$
0
0

Hello, I'm trying to refactor this because I think it can be cleaner but I'm not sure how. It's about the 'notification' object.

I have this provider, which defines the possible notifications (/errors):

import {Injectable} from '@angular/core';

@Injectable()
export class GlobalProvider {
    notification: object;

    constructor() {
        this.notification = {
            internal: {
                image: 'assets/img/interne-fout.svg',
                title: 'Er is een interne fout',
                content: 'Probeer het opnieuw, als het probleem aanhoudt neem contact op'
            },
            internet: {
                image: 'assets/img/geen-data.svg',
                title: 'Je hebt geen verbinding',
                content: 'Check je internetconnectie en probeer het nogmaals'
            }
        };
    }

    isOnline() {
        return navigator.onLine;
    }
}

In my component I have this.

    notification: object = {image: '', title: '', content: ''};


/**
         * Only do request when online.
         */
        if (globalProvider.isOnline()) {
            this.sendHTTPRequest();
        } else {
            this.notification = globalProvider.notification['internet'];
        }

        /**
         * Watch for reconnect after disconnect.
         */
        this.network.onConnect().subscribe(() => {
            this.sendHTTPRequest();
            this.notification = {image: '', title: '', content: ''};
        });

Is there any better way to do this? I don't like the redefining the structure of notification in the component part. Feels wrong somehow.

Help needed: A "solved" problem with end tags

$
0
0

Thank you for the help! I edited the post.

Unable to get scroll events in ion-scroll

Ion-item detail-push / detail-none attribute binding

$
0
0

Solved the issue by using ion-icons <ion-icon right float-right *ngIf="showArrow(item)" name="arrow-forward"></ion-icon>.

Thanks everyone for your help...

Error: Failed to fetch platform cordova-android@^6.2.3

$
0
0

Whenever I try to run cordova platform add android --save comman i get this error, is anyone able to help me with this?

Missing info.plist key - build rejected

$
0
0

This is what I'm gonna try: I will manually change the archive's Info.plist.
I'd still prefer a proper solution to this though.

I'll add the differences in here to elaborate the issue.

This is the project's Info.plist source:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleDisplayName</key>
	<string>${PRODUCT_NAME}</string>
	<key>CFBundleExecutable</key>
	<string>${EXECUTABLE_NAME}</string>
	<key>CFBundleIcons</key>
	<dict/>
	<key>CFBundleIcons~ipad</key>
	<dict/>
	<key>CFBundleIdentifier</key>
	<string>be.domain.appname</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>${PRODUCT_NAME}</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0.2</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1.0.2</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
		<key>NSExceptionDomains</key>
		<dict>
			<key>192.168.0.155</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
			<key>192.168.0.166</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
			<key>192.168.0.168</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
			<key>192.168.0.175</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
			<key>ionic.local</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
			<key>youtube-nocookie.com/*</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
				<key>NSIncludesSubdomains</key>
				<true/>
			</dict>
			<key>youtube.com/*</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
				<key>NSIncludesSubdomains</key>
				<true/>
			</dict>
		</dict>
	</dict>
	<key>NSCameraUsageDescription</key>
	<string>Camera usage description here.</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string></string>
	<key>NSMainNibFile~ipad</key>
	<string></string>
	<key>NSPhotoLibraryUsageDescription</key>
	<string></string>
	<key>UIInterfaceOrientation</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
	</array>
	<key>UIRequiresFullScreen</key>
	<true/>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
	</array>
</dict>
</plist>

This is the Build Archive's Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ApplicationProperties</key>
	<dict>
		<key>ApplicationPath</key>
		<string>Applications/Appname.app</string>
		<key>CFBundleIdentifier</key>
		<string>be.domain.appname</string>
		<key>CFBundleShortVersionString</key>
		<string>1.0.2</string>
		<key>CFBundleVersion</key>
		<string>1.0.2</string>
		<key>SigningIdentity</key>
		<string>iPhone Developer: name (identifier)</string>
	</dict>
	<key>ArchiveVersion</key>
	<integer>2</integer>
	<key>CreationDate</key>
	<date>2017-07-07T08:57:19Z</date>
	<key>Name</key>
	<string>Appname</string>
	<key>SchemeName</key>
	<string>Appname</string>
</dict>
</plist>

Image not displaying while displaying contacts

$
0
0

As we are moving in circles here, I decided to quickly build this myself:
https://github.com/janpio/ionic-native-contacts/

We start with a blank Ionic project:
https://github.com/janpio/ionic-native-contacts/commits/start

First we add Ionic Native contacts and do a simple console.log on all the contacts we get back:
https://github.com/janpio/ionic-native-contacts/commits/log
https://github.com/janpio/ionic-native-contacts/commit/1a69566e35103672e9d98a1958e7652faae55be6#diff-cee9e659d51e33fd1c3c22b4d9da7bd2R19

Now we know the structure of contacts and know contacts have a photos key that can be either null or an list of objects:

With that knowledge we can output all contacts that DO have a picture:
https://github.com/janpio/ionic-native-contacts/commits/contactList
https://github.com/janpio/ionic-native-contacts/commit/903007e3af8e4d27815663f394bcb62950dc0634

That shows us what you got all the time:

In the console we get this:


but also this:

That URL gives us the code we need to implement to fix this: https://angular.io/guide/security#bypass-security-apis

Implemented this changes our code to this:
https://github.com/janpio/ionic-native-contacts/commit/272b78b2a47e9391e2d4f5f373830566d3f0beb3

Success - our contact list now shows our contacts that have photos and the images actually load!

And now that we know it works, we can also add all the other contacts to our list and give them a default image to make it more useful:
https://github.com/janpio/ionic-native-contacts/commit/160ddf9f2b1f305c77db7ce45bb80eb8ab004837

And with that my contact list output looks like this:

Done.


Ionic 1.x and 2.x in the same machine

$
0
0

Nope, I am suggesting everybody use nvm or nvm-windows - it's great. But not necessarily for the reason to have several different Ionic CLI - but to have different npm, node, cordova if necessary. Working with the newest Ionic CLI is always a good idea if your project is compatible - and almost all are (v2 betas excluded).

Error: Failed to fetch platform cordova-android@^6.2.3

$
0
0

Show us more of the output please.
Also run the same command with --verbose --debug at the end.

getRootNav() deprecated, use getRootNavById(): what's the value of the root nav id?

$
0
0

thx but I rather not to, to much risk to generate null pointer exception

I am getting difficult to integrate calendar and add event

Image not displaying while displaying contacts

$
0
0

Try to learn from what @Sujan12 has posted, take this whole exercise as a learning experience.

For your purposes though, we just need to check both photos being not null and photos being not empty as follows:

if((contacts[i].displayName !== null) && (contact.photos!==null && contacts[i].photos.length > 0))

This is because it seems that if there is no photo set for the contact then the photos can be null and it can possibly be an empty array too, if at all not null.

How to run ionic 2 app on real windows device using command prompt

$
0
0

Which Tools required for build ios app in ionic 2 from windows 10 operating system?
how to build windows app from windows 10 OS without install VS2015 ?
i am only use VS CODE editor

Image not displaying while displaying contacts


Wait for Local Storage [SOLVED]

$
0
0

Hello LolStats,

How you fixed your issue. I have the same prolem, i want to get user information in localstorage to load in form.

Please can you help ?

Regards,

Ionic cordova platform add android: npm ERR! Error: EPERM: operation not permitted, lstat

$
0
0

I am getting the same error after updating npm.

$ ionic cordova build android --verbose --debug
[DEBUG] Loading global plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for global @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
[DEBUG] Getting plugin info for ionic
[DEBUG] Getting plugin info for @ionic/cli-plugin-cordova
[DEBUG] Getting plugin info for @ionic/cli-plugin-ionic-angular
[DEBUG] Checking for latest plugin version of ionic@latest.
[DEBUG] Checking for latest plugin version of @ionic/cli-plugin-cordova@latest.
[DEBUG] Checking for latest plugin version of
        @ionic/cli-plugin-ionic-angular@latest.
[DEBUG] Latest version of ionic@latest is 3.4.0.
[DEBUG] Latest version of @ionic/cli-plugin-ionic-angular@latest is 1.3.1.
[DEBUG] Latest version of @ionic/cli-plugin-cordova@latest is 1.4.0.
Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser

[15:23:47]  build dev started ...
[15:23:48]  clean started ...
[15:23:48]  clean finished in 1 ms
[15:23:48]  copy started ...
[15:23:48]  transpile started ...
[15:23:54]  transpile finished in 6.63 s
[15:23:54]  preprocess started ...
[15:23:54]  deeplinks started ...
[15:23:54]  deeplinks finished in 47 ms
[15:23:54]  preprocess finished in 47 ms
[15:23:54]  webpack started ...
[15:23:55]  copy finished in 7.14 s
[15:24:03]  webpack finished in 8.91 s
[15:24:03]  sass started ...
[15:24:04]  sass finished in 861 ms
[15:24:04]  postprocess started ...
[15:24:04]  postprocess finished in less than 1 ms
[15:24:04]  lint started ...
[15:24:04]  build dev finished in 16.50 s
> cordova build android --debug
\ Running command [15:24:09]  lint finished in 4.81 s
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[DEBUG] !!! ERROR ENCOUNTERED !!!
[ERROR] An error occurred while running cordova build android --debug (exit code
        1):

        (truncated) ... roblem, or plugin spec is incorrect.
        Check your connection and plugin name/version/URL.
        Error: cmd: Command failed with exit code 4294963248 Error output:
        npm ERR! path
        C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\node_modules\fsevents\node_modules\getpass\node_modules
        npm ERR! code EPERM
        npm ERR! errno -4048
        npm ERR! syscall lstat
        npm ERR! Error: EPERM: operation not permitted, lstat
        'C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\node_modules\fsevents\node_modules\getpass\node_modules'
        npm ERR!     at Error (native)
        npm ERR!  { Error: EPERM: operation not permitted, lstat
        'C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\node_modules\fsevents\node_modules\getpass\node_modules'
        npm ERR!     at Error (native)
        npm ERR!   stack: 'Error: EPERM: operation not permitted, lstat
        \'C:\\lakshmanan\\Test\\TestRepo\\AnimalTrackerApp\\UserApplication\\node_modules\\fsevents\\node_modules\\getpass\\node_modules\'\n
        at Error (native)',
        npm ERR!   errno: -4048,
        npm ERR!   code: 'EPERM',
        npm ERR!   syscall: 'lstat',
        npm ERR!   path:
        'C:\\lakshmanan\\Test\\TestRepo\\AnimalTrackerApp\\UserApplication\\node_modules\\fsevents\\node_modules\\getpass\\node_modules'
        }
        npm ERR!
        npm ERR! Please try running this command again as root/Administrator.

        npm ERR! A complete log of this run can be found in:
        npm ERR!
        C:\Users\lakshmanank\AppData\Roaming\npm-cache\_logs\2017-07-07T09_55_47_654Z-debug.log
        Discovered plugin "ionic-plugin-keyboard" in config.xml. Adding it to
        the project
        Installing "ionic-plugin-keyboard" for android
        ANDROID_HOME=C:/Users/Administrator/AppData/Local/Android/sdk/
        JAVA_HOME=C:/Program Files/Java/jdk1.8.0_111/
        :wrapper

        BUILD SUCCESSFUL

        Total time: 3.029 secs
        Subproject Path: CordovaLib
        The Task.leftShift(Closure) method has been deprecated and is scheduled
        to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at
        build_3o65ouaikvlfanpbb4bb3rfkb.run(C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\platforms\android\build.gradle:137)
        The JavaCompile.setDependencyCacheDir() method has been deprecated and
        is scheduled to be removed in Gradle 4.0.
        Incremental java compilation is an incubating feature.
        The TaskInputs.source(Object) method has been deprecated and is
        scheduled to be removed in Gradle 4.0. Please use
        TaskInputs.file(Object).skipWhenEmpty() instead.
        :preBuild UP-TO-DATE
        :preDebugBuild UP-TO-DATE
        :checkDebugManifest
        :CordovaLib:preBuild UP-TO-DATE
        :CordovaLib:preDebugBuild UP-TO-DATE
        :CordovaLib:checkDebugManifest
        :CordovaLib:prepareDebugDependencies
        :CordovaLib:compileDebugAidl
        :CordovaLib:compileDebugNdk UP-TO-DATE
        :CordovaLib:compileLint
        :CordovaLib:copyDebugLint UP-TO-DATE
        :CordovaLib:mergeDebugShaders
        :CordovaLib:compileDebugShaders
        :CordovaLib:generateDebugAssets
        :CordovaLib:mergeDebugAssets
        :CordovaLib:mergeDebugProguardFiles
        :CordovaLib:packageDebugRenderscript UP-TO-DATE
        :CordovaLib:compileDebugRenderscript
        :CordovaLib:generateDebugResValues
        :CordovaLib:generateDebugResources
        :CordovaLib:packageDebugResources
        :CordovaLib:processDebugManifest
        :CordovaLib:generateDebugBuildConfig
        :CordovaLib:processDebugResources
        :CordovaLib:generateDebugSources
        :CordovaLib:incrementalDebugJavaCompilationSafeguard
        :CordovaLib:compileDebugJavaWithJavac
        :CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs
        have changed, no previous execution, etc.).
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        :CordovaLib:processDebugJavaRes UP-TO-DATE
        :CordovaLib:transformResourcesWithMergeJavaResForDebug
        :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
        :CordovaLib:mergeDebugJniLibFolders
        :CordovaLib:transformNative_libsWithMergeJniLibsForDebug
        :CordovaLib:transformNative_libsWithSyncJniLibsForDebug
        :CordovaLib:bundleDebug
        :prepareOrgApacheCordovaCordovaLib623DebugLibrary
        :prepareDebugDependencies
        :compileDebugAidl
        :compileDebugRenderscript
        :generateDebugBuildConfig
        :generateDebugResValues
        :generateDebugResources
        :mergeDebugResources
        :processDebugManifest
        :processDebugResources
        :generateDebugSources
        :incrementalDebugJavaCompilationSafeguard
        :compileDebugJavaWithJavac
        :compileDebugJavaWithJavac - is not incremental (e.g. outputs have
        changed, no previous execution, etc.).
        :compileDebugNdk UP-TO-DATE
        :compileDebugSources
        :mergeDebugShaders
        :compileDebugShaders
        :generateDebugAssets
        :mergeDebugAssets
        :transformClassesWithDexForDebug
        :mergeDebugJniLibFolders
        :transformNative_libsWithMergeJniLibsForDebug
        :processDebugJavaRes UP-TO-DATE
        :transformResourcesWithMergeJavaResForDebug
        :validateSigningDebug
        :packageDebug
        :assembleDebug
        :cdvBuildDebug

        BUILD SUCCESSFUL

        Total time: 10.182 secs
        Built the following apk(s):

Just released: Tooltips Module for Ionic Apps

How to run ionic app on real windows device using command prompt

$
0
0

Totally different question, please create a new topic.

I don't think this is possible - Visual Studio installs the tools needed in the right locations etc. You would have to ask the Cordova people at http://issues.cordova.io -> Issues

Issue in using custom Cordova plugin with Ionic app

$
0
0

Plugin id in plugin.xml had period ( . ). I replaced it with ( - ). This fixed the issue.

Viewing all 228529 articles
Browse latest View live


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