Git Product home page Git Product logo

Comments (2)

stephanrauh avatar stephanrauh commented on July 30, 2024

I'm not sure, but the issue may have been caused by moving handleAjaxUpdates from oncomplete to onsuccess (which in turn was necessary because the $injector tends to get lost or inaccessible after destroying scopes).

        jsf.ajax.addOnEvent(function (data) {
            if (data.status === 'begin') {
                requestOngoing = true;
                onCompleteCallbacks = [];
            }
            if (data.status === 'complete') {
            }
            if (data.status === 'success') {
                // todo: handleAjaxUpdates() should be called in the 'complete' branch 
                // - find a way to pass the injector around
                var theInjector=destroyScopes(data.responseXML);
                handleAjaxUpdates(data.responseXML, theInjector);
                requestOngoing = false;
            }
        });

from jsf-updates-angular.

marcorinck avatar marcorinck commented on July 30, 2024

Small typo: originally destroyScopes is done in complete phase and handleAjaxUpdates is done in succcess phase. In your code you moved destroyscopes and not handleAjaxUpdates from complete to success phase.

As described in #3 the order when to destroy old scopes and when to let angular know about new elements is very important!

destroyScopes needs to be done in complete phase as only in this phase, JSF hasn't touched the DOM and has NOT updated the nodes with new ones. You NEED to destroy scopes in this phase, as updated DOM nodes don't know anything about angular and vice versa. As angular wouldn't be able to destroy anything this would cause a memory leak.

In success phase the DOM is updated by JSF and angular can do its magic for them.

I assume that your fix to get the injector and this move of destroying scopes in later phase are connected and is causing your problems.

from jsf-updates-angular.

Related Issues (6)

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.