angularjs - ui-router resolve behaves strangely in Ionic -


"itemprop =" text ">

I started with a demo Ionic app ( Ionic started MyApp sidemenu ) ,:

  Resolution: {Problem: function ($ q, $ timeout) {var defer = $ q.defer (); //defer.reject (); // browser or tool $ timeout (defer.reject) does not work; // works in the browser, but do not defer.promise the device return; }}   

I have rejected the solution here:

  .run (function ($ ionicPlatform, $ rootScope, $ IonicLoading) {$ ionicPlatform.ready (function () {// Here $ regular items at rootScope $ ('$ stateChangeError', function () {$ ionicLoading.show ({template: '! All good'})}} .});});   

For any reason, if solves immediately rejects (see defer.reject () above), $ Callback state change error is not running. If I do exactly that, but outside of Ionic,

besides, is trying to delay $ timeout (defer.reject) rejection Solve; In a different behavior, it now works in a browser as expected, but still does not work on the device. In an attempt to delay further, results in success on the device: $ timeout (function () {defer.reject ();}, 250); // 200 or less does not work for me

Can someone put light on it?

with kangaroo and promise model from experience. In order to solve the order / a promise angular reject the JS incident will have to tick a cycle again in the loop - nextTick - and this is $ scope.apply () which is how we use the fun blow of such things in the unit test Taxes can be completed <. P> This is a great way to talk about the $ timeout and the scope of $. $ EvalAsync- I can assemble the timeout, evaluating the function in the next tick. The reason for this is that this code works in the way you outline.

  Resolution: {problem: function ($ q, $ timeout) {var defer = $ q.defer (); //defer.reject (); // & lt; ---- Next set timeout (defer.reject); // & lt; ---- $ Timeout evaluates on next return defer.promise; }}   

This is another that talks about the texttech implementation of $ q.

I know that this does not solve your problem - but it should highlight some of the reasons why this is happening! Good luck!

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -