Giter VIP home page Giter VIP logo

Comments (11)

nikravi avatar nikravi commented on May 9, 2024

+1

from zone.js.

btford avatar btford commented on May 9, 2024

Please provide a reproduction via plnkr.co, jsfiddle, or [jsbin(http://jsbin.com/). This saves me a lot of time. Thanks!

from zone.js.

hkyip avatar hkyip commented on May 9, 2024

fixed my link.. sorry guys.
http://plnkr.co/edit/pm5yrJ?p=info

from zone.js.

MartinLienhard avatar MartinLienhard commented on May 9, 2024

I have a problem using long-stack-trace-zone.js with angular too. When I use angulars $timeout its not possible to get a stack trace. Using setTimeout works perfectly fine. Same issue using $promise.

http://plnkr.co/edit/OvExnTzRQaSGv45evxHv

from zone.js.

btford avatar btford commented on May 9, 2024

Looking into it. Thanks for the reproductions.

from zone.js.

RobertjanTuit avatar RobertjanTuit commented on May 9, 2024

Any updates on using zone.js in this way with angular 1.4?

from zone.js.

matthewjh avatar matthewjh commented on May 9, 2024

Pretty sure this is because angular's $exceptionHandler eats uncaught exceptions inside $apply'd functions/expressions and logs them to the console. This means they will never reach zone.

In my angular 1.x app that I'm using with zone, I'm decorating $exceptionHandler to rethrow errors.

See https://docs.angularjs.org/api/ng/service/$exceptionHandler

from zone.js.

RobertjanTuit avatar RobertjanTuit commented on May 9, 2024

Thanks! Would you mind sharing an example of how you are doing the decoration?

Sent from my iPhone

On Sep 9, 2015, at 9:12 AM, Matthew Hill <[email protected]mailto:[email protected]> wrote:

Pretty sure this is because angular's $exceptionHandler eats uncaught exceptions inside $apply'd functions/expressions and logs them to the console. This means they will never reach zone.

In my Angular 1.x app that I'm using with zone, I'm decorating $exceptionHandler to rethrow errors.


Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-138959706.

from zone.js.

matthewjh avatar matthewjh commented on May 9, 2024

Sure. Off the top of my head:

module.config(function($provide) {
  $provide.decorator('$exceptionHandler', function($exceptionHandler) {
       return function(error, cause) {
            $exceptionHandler(error, cause);
            throw error;
       };
   });
});

from zone.js.

RobertjanTuit avatar RobertjanTuit commented on May 9, 2024

Thank you sir! :)

Sent from my iPhone

On Sep 9, 2015, at 9:33 AM, Matthew Hill <[email protected]mailto:[email protected]> wrote:

Sure. Off the top of my head:

module.config(function($provide) {
$provide.decorator('$exceptionHandler', function($exceptionHandler) {
return function(error, cause) {
$exceptionHandler(error, cause);
throw error;
};
});
});


Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-138965024.

from zone.js.

gaui avatar gaui commented on May 9, 2024

Why hasn't this been addressed? I'm currently using zone.js 0.5.15 (outdated) to be able to use Fetch API instead of $http in my Angular 1.x app but trigger the digest cycle after multiple asynchronous operations. I haven't been successful using the new API, so I would like some guidance.

What I'm doing is the following:

// Zone addon, so it wraps the promise chain in one "zone" and
// executes some arbitrary task (in this case rootScope digest run)
// after the promise chain.

const scopePrototype = $rootScope.constructor.prototype;
const originalApply = scopePrototype.$apply;
const zoneOptions = {
    afterTask: function afterTask() {
        try {
            $rootScope.$digest();
        } catch (e) {
            $exceptionHandler(e);
            throw e;
        }
    }
};

scopePrototype.$apply = function $applyFn() : void {
    // tslint:disable-next-line:no-var-self
    const scope = this;
    const applyArgs = arguments;

    window.zone.fork(zoneOptions).run(() => {
        console.log('Running zone');
        originalApply.apply(scope, applyArgs);
    });
};

from zone.js.

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.