AngularJS: cross communication between controllers without an event to update the service

11 views
Skip to first unread message

krama...@google.com

unread,
Feb 15, 2018, 2:46:36 AM2/15/18
to Angular and AngularJS discussion

Is it feasible to access a controller_1 method from another controller_2 using service when there is no event on controller_1 that will update the service?

Sander Elias

unread,
Feb 15, 2018, 12:20:42 PM2/15/18
to Angular and AngularJS discussion
Hi,

Can you provide some more context or a code sample of what it is you are trying to do?

Regards
Sander

krama...@google.com

unread,
Feb 15, 2018, 12:59:52 PM2/15/18
to Angular and AngularJS discussion
controller_1:
There are 2 fields in settings view (field1 has default value and field2 is the required field and both are associated)

Controller_2:
Publish the form but before publish check whether field1 and field2 of settings view is correct.
(if field1 == def_val && !field2)

How to verify the fields of controller_1 in controller_2 without any event on controller_1?
In a case where the user doesnot make any modifications in the settings and publish the form.
How to make sure that the field2 which is required field in settings view is non-empty without any event on settings view?
Reply all
Reply to author
Forward
0 new messages