How to update Parent Component data from Child Component without two way data binding in angular 1.5.x?

浪尽此生 提交于 2019-12-13 07:15:10

问题


Sorry if it's a silly question but i am a noob in angular 1.5.x

I am using es6 class based components with one way data bindings throughout the app(best practices as far as i know).

I have a Container Component. It has a Sidebar Component and a Content Component.

I fetch the menu options (array or object) in Container Component and pass it to Sidebar Component and Content Component using one way data binding as attributes.

I want to update the Container Component whenever i change menu options in Sidebar Component or Content Component and it should be reflected in both the child components.

I don't seem to find a way ( without two way data binding ) to do it in angular 1.5 without using $scope events or Service.

来源:https://stackoverflow.com/questions/41058427/how-to-update-parent-component-data-from-child-component-without-two-way-data-bi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!