In my current application, I have a save function in one of my backbone views.
custom_save : function() {
// this method's save code
// have to call another views save function here
}
The other view name is App.SettingsView and it has a save method. I have to call this save method right after the custom_save logic. How can I call App.SettingsView save function inside custom_save function. Please not both are 2 different files
Thanks
It’s a bad practice you got there. Coupling between the views. Why don’t you create a EventBus that inherits from the
Backbone.Eventsthen trigger the event that the another view subscribes too. When event occurs just trigger the save function that’s itView#1 Save
View#2 Save
Sounds nice ? It should 🙂