Git Product home page Git Product logo

Comments (4)

christianalfoni avatar christianalfoni commented on August 23, 2024

Hm, just repeating to see if I understand this correctly.

You have a directive that receives the config object from a parent controller/directive which gets it from the immutable store? When the parent of directive updates, the passed config object does not update in the directive?

from flux-angular.

steven-prybylynskyi avatar steven-prybylynskyi commented on August 23, 2024

@christianalfoni exactly, and some of the deep values from $scope.config are required in e.g. ng-model.

I understand that the isolate scope is still bound to old instance of 'some.object.from.parent.scope' and $listenTo cannot be used in a directive that is part of ng-repeat because of EventEmitter limitations.

Solution to this problem may look quite complicated.
In the directive that is part of ng-repeat I listen for an event:

$scope.$on('MyStoreUpdated', function update() { 
    $scope.someArray[index] = config.someArray[index]; 
});

The config service emits the MyStoreUpdated after getting required data from the immutable store, it communicates with the store through actions and gets data from exports and then converts that data to regular object for ng-model with toJS().

The system looks very verbose and I hope that with Cerberal being more thoughtful in managing states will lower the verbosity.

from flux-angular.

christianalfoni avatar christianalfoni commented on August 23, 2024

Hi @pribilinskiy,

Yeah, flux-angular is based on the early implementation of Flux. Specifically the Yahoo version of flux. A lot has happened since then and Cerebral has taken all the goodness of immutability and a "single state store", a long with its own ability to express complex state changing flows.

Cerebral is starting to get a good foothold and I really hope to bring devs from flux-angular over to the new project as it is more mature in the sense of what flux has evolved to :-)

Hm, seems a bit weird that the old reference to config is kept as the parent will change it when store updates. Angular was never really built for immutability so we might have found a scenario where Angular comes a bit short. I would have to look more deeply into this, but as you have found a solution I will have to fix some more pressing issues first.

Let me know if you think this should be a priority :-)

from flux-angular.

jrust avatar jrust commented on August 23, 2024

Version 3.0 has lowered some of the verbosity and changed the emitter library which should help. Additionally, you can now listen for changes on a specific index in an array if you want, see #59

from flux-angular.

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.