Comments (4)
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.
@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.
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.
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)
- example: MyStore is not defined HOT 2
- Cannot call dispatch while another dispatch is executing HOT 2
- flux-angular IE8 problems HOT 2
- immutable-store deprecated, other options? HOT 8
- Export "flux" module name in commonJS module. HOT 1
- Suppress webpack `Critical dependencies` warning message HOT 3
- $listenTo never updates the scope
- Emit custom event from each store HOT 1
- browserify the src is unsuccessful HOT 8
- controllerAs HOT 2
- No digest after server data was retrieved. HOT 6
- Best Way to object update in a collection HOT 1
- Dependency of angular HOT 1
- (Ignore, created issue on accident, apologies)
- Some $listenTo callbacks run outside of the digest cycle when Baobao is in asynchronous mode HOT 2
- Latest releases are not available via NPM HOT 2
- webpack2 report error HOT 2
- Question: How to map const action to function helpers? HOT 2
- QUESTION: How to attach store from another module? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flux-angular.