Navigation

    Monaca & Onsen UI
    • Login
    • Search
    • Tags
    • Users
    • Blog
    • Playground
    1. Home
    2. PA
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    PA

    @PA

    2
    Reputation
    6
    Posts
    945
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    PA Follow

    Posts made by PA

    • RE: [SOLVED] Override Onsen UI v1 pushPage function

      I solved my problem this way:

      // Onsen UI v1 dit not get this bugfix to prevent loading the page twice if user taps twice
      // so we backport it from https://github.com/OnsenUI/OnsenUI/pull/1176/commits/b06a6bacca672462e661100ac0e1eda18121aa16
      angular.module('onsen').run(['NavigatorView', function(NavigatorView) {
          NavigatorView.prototype.pushPage = function(page, options) {
              if (this._profiling) {
                console.time('pushPage');
              }
      
              options = options || {};
      
              if (options.cancelIfRunning && this._isPushing) {
                return;
              }
      
              if (options && typeof options != 'object') {
                throw new Error('options must be an object. You supplied ' + options);
              }
      
              if (this._emitPrePushEvent()) {
                return;
              }
      
              // the backport is just this line...
              this._isPushing = true;
      
              this._doorLock.waitUnlock(function() {
                this._pushPage(page, options);
              }.bind(this));
          };
      }]);
      
      posted in Onsen UI
      PA
    • [SOLVED] Override Onsen UI v1 pushPage function

      Hello,

      I would like to backport this bugfix to my v1 onsen ui apps :
      https://github.com/OnsenUI/OnsenUI/pull/1176/commits/b06a6bacca672462e661100ac0e1eda18121aa16

      I don’t want to change the existing files, so I hoped I could somewhat redefine/override/overload the NavigatorView.pushPage function, but I can’t figure out how to do that… Any ideas ?

      posted in Onsen UI
      PA
    • Onsen.io main domain name

      Hello,

      I noticed that Google points me to http://onsen.io.s3-website-us-east-1.amazonaws.com/ instead of https://onsen.io/

      I believe it’s just a misconfiguration.

      I haven’t found where to throw this so I came here…

      posted in Onsen UI
      PA
    • RE: Delayed page loading

      @Fran-Diox ok I see what you meant. Thank you.

      Now, this means I will have to re-architect some things!

      posted in Developer Corner
      PA
    • RE: Delayed page loading

      I will try to better explain how things currently work in my app.

      First myNavigtor.pushPage('page.html') gets page.html, which contains <ons-page ng-controller="pageController">. And pageController looks like this:

      app.controller('pageController', ['page', function(page) {
          $scope.data = page.get('products');
      }
      

      So first the page is shown, then the controller is called, and the user has to wait with a blank page while the data is being fetched.

      I would prefer the page to be shown after the data has been fetched. Is there a way to run my controller before the view is shown, and trigger the display ?

      @Fran-Diox if I get it right, the approach you suggest is to pre-fetch data. That could help to prevent the user to have to wait, but it’s not what I am trying to achieve and it doen’t fit my use case: we display a list of posts, you tap one and you get the details… pre-fetching all articles details would require too much networking.

      posted in Developer Corner
      PA
    • Delayed page loading

      Hello,

      My app grabs data from a remote API. I would like to run the page transition AFTER the data has been fetched. How could I do that?

      Currently, myNavigtor.pushPage(...) runs my page’s AngularJS controller AND displays the page.
      So my app displays an empty page, while waiting for the API response for a little time, before real content is displayed.

      I would like it to just run the controller, and let the controller trigger the page transition… is it even possible?

      Thank you.

      posted in Developer Corner
      PA