0

take simple 'list' component and 'list-item component'. I will click 'update' @output function at 'list-item' component, but since emitter is 'void' I have no way of getting information that item was saved or not, and 'list-item' detail can be closed.

In angular 1, I can just bind & callback returning promise, and do detail close on .then() inside Child component. How can I reach same goal of letting one of child components know that it was saved?

6
  • I know about, stackoverflow.com/questions/35328652/… but it only shows some 'hacky?' way to do that + there is no example with also passing parameters. What is the expected best practice way to implement this? I definitely do not want ajax calls directly in child component. Commented Aug 29, 2018 at 23:16
  • If I understood what you want, can't you just put a boolean Input 'saved' to know if it has been saved or not? Commented Aug 30, 2018 at 9:03
  • Hello, I would have to pass that down components tree, and it can be an error which I would have to pass as another value down to the tree, and would need another ones for deleting items, really troublesome. Funny is I started 2 projects one on Agular 1 and another on angular 6 at same time (was working on Ember 2 before - that one is best on market really), so I am also solving very simillars problems on both projects, and must say Angular 1 is much more realiable/solid than 6 is, but thats just personal thought. Commented Aug 30, 2018 at 10:27
  • Look at this post, maybe it can help? Commented Aug 30, 2018 at 10:39
  • Thats one i mentioned in first comment :), there is no example of binding this with parameters and its some kind of hack more or less. And accepted answer is telling that its impossible. Commented Aug 30, 2018 at 10:48

0

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.