Coder Social home page Coder Social logo

Comments (6)

tjvantoll avatar tjvantoll commented on August 28, 2024

I'm not sure if this is related, but I've been trying to get this plugin to work in an Ionic app and having problems. As soon as I pass window.plugins.nativepagetransitions.flip/slide() an href nothing works.

You can see the issue by cloning this repo, and adding the following code after this line in the ready block:

setTimeout(function() {
    // This works
    // window.location.href = "#/tab/settings";

    // This doesn't
    window.plugins.nativepagetransitions.flip({
        href: "#/tab/settings"
    });
}, 2000);

Any ideas @EddyVerbruggen?

from nativepagetransitions.

EddyVerbruggen avatar EddyVerbruggen commented on August 28, 2024

@tjvantoll What does seem to work is href: "index.html#/tab/settings" instead of href: "#/tab/settings"

The plugin should be able to handle your href as well though, so I will fix that.

from nativepagetransitions.

tjvantoll avatar tjvantoll commented on August 28, 2024

@EddyVerbruggen Yep, index.html#/tab/settings works as expected. Thanks for the help!

from nativepagetransitions.

leandroz avatar leandroz commented on August 28, 2024

Hey Guys!
I am using the plugin with UI-Router, i created a service for navigation that takes the name of the state and the params, create the url and make the transition using the href property. The problem that i have is that the event stateChangeSuccess is triggered before the transition is complete. Could this cause problems?

from nativepagetransitions.

lylepratt avatar lylepratt commented on August 28, 2024

I'm experiencing something similar. If I pass index.html#/myroute, the main view immediately transitions, then about 10 seconds later I get an Application Error:

The connection to the server was unsuccessful. (file://android_asset/www/index.html#/myroute)

Anyone get this to work with angular yet?

from nativepagetransitions.

leandroz avatar leandroz commented on August 28, 2024

I am using it and is working ok, not perfect but ok. I am using a service for replacing the $state.go of UI-Router, here is the code.

$pageTransitions.transitionTo = function(state, params, transition, direction) {
            var deferred = $q.defer();
            var urlFormated = $state.href(state, params);
            console.log('URL FORMATED');
            console.log(urlFormated);
            if (transition == 'slide') {
                slideOptions.href = 'index.html' + urlFormated;
                slideOptions.direction = direction;
                window.plugins.nativepagetransitions.slide(
                    slideOptions,
                    function(msg) {
                        console.log('$pageTransitions.transitionTo --> Success');
                        deferred.resolve();
                    },
                    function(msg) {
                        console.log('$pageTransitions.transitionTo --> Error');
                        deferred.reject();
                        //$state.go(state, params);
                    }
                );
            } else if (transition == 'flip') {
                flipOptions.href = 'index.html' + urlFormated;
                flipOptions.direction = direction;
                window.plugins.nativepagetransitions.flip(
                    flipOptions,
                    function(msg) {
                        console.log('$pageTransitions.transitionTo --> Success');
                        deferred.resolve();
                    },
                    function(msg) {
                        console.log('$pageTransitions.transitionTo --> Error');
                        deferred.reject();
                        //$state.go(state, params);
                    }
                );
            }
            return deferred.promise;
        };

Then if the transition was successful, i am broadcasting an event and using it in the controller if i need to init something after the transition is completed. $rootScope.$broadcast('transition:success');

from nativepagetransitions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.