0

Have some data for one controller JSON, I fill by this data in ng-repeat my view. But when selecting this data from view I need pass selected data to Form Controller fill all forms.

I don't know how to do this in angularJS with components. I built service, which parse data when i select it and pass to Form Controller. But it's additional work parse it again by service.Maybe exist some more good way how pickup just id, and Form Controller load it automatically when get id's from service.

AngularJS really hard for all ways as I understood :(

2
  • 1
    can you show the code you have tried to demonstrate the problem Commented Jun 22, 2016 at 21:46
  • I don't know is'it possible in General Commented Jun 22, 2016 at 22:11

1 Answer 1

1

It's better to provide some code samples with the question. Actually you have 3 main ways to share data between modules - parent controller, rootScope and services. Ok, there is event emitter here, but I heard opinions that it's not 'Angular way' to use events, because it's hard to maintain this architecture later. As I understood, you are using service for this porpoise and it's fine. Since Service is Singleton in Angular you can use it not only to share reusable peaces of code but and for sharing data between controllers.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes, but I don't know how to build right code for do what I want to achieve - I don't want parse data with service from view in one controller.
It will be ridiculous, parse data again if You have this date already like object. When I more try to do something with angularjs - more I understand - that this framework - is not good choiсe, to many problem should be solved for do really simply things (
Absolutely not. It's good choice for many simple things because there are many solutions out of the box. But on the other hand Angular by itself is difficult because of it. Probably you will spend some time to know it better. But all what you need next time is provide some code example even if you are not sure that you are doing it in right way. I don't even know what the version of Angular you are using and for what you are using ng-repeat. It can be select tag or checkboxes or something else. Sorry but I can say nothing more without additional information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.