Multiple JavaScript files accessing same Controller

39 views
Skip to first unread message

Varun Tyagi

unread,
Apr 29, 2015, 11:43:15 AM4/29/15
to ang...@googlegroups.com

Hi

I have a scenario where I have different views and I want them to have their respective JS files but all sharing the same controller. Is it possible in angular?

Any help is appreciated.

Thanks
Varun Tyagi

Kiran A

unread,
May 1, 2015, 12:19:19 AM5/1/15
to ang...@googlegroups.com


Hi varun,


you can share the same controller for different views

VARUN TYAGI

unread,
May 1, 2015, 2:26:18 AM5/1/15
to ang...@googlegroups.com
Hi Kiran

I agree that same controller can be shared across different views. But to distribute a complex logic across several JavaScript files, I want those JS files as well to use same Scope/controller.

Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/sWNLvDVhD7E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Kiran A

unread,
May 1, 2015, 3:23:58 AM5/1/15
to ang...@googlegroups.com
Hi,

Define a main controller on highest element and define the other controller under the main controller, then you can inherit the logic any where

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages