CONNECT SEPARATE ANGULAR CONTROLLERS FILE TO MY APP LOGIC FILE - 01.19.17

9 views
Skip to first unread message

mrjap1

unread,
Jan 19, 2017, 5:33:15 PM1/19/17
to Angular

Hello there!!

I have an Angular js 1.6  Application. I created a file called " myapp.js "  with my application.
Unfortunately, the multitude of controllers I am using is giving me way too many lines of code in one file and becoming to messy. 

I want to keep my large extensive list of angular js controllers in one file called " controllers.js " and my " myapp.js "  with routes, tables separate.

However, I want all of my various controllers found in  " controllers.js "  to respond and connect easily to my " myapp.js " file containing my business logic. 

Everything works fine on one page and fails when i separate them in 2 files. I must be doing something wrong. 

How do I accomplish this?

I need a code sample to best illustrate this. Can anyone help me out.

- mrjap1



Sander Elias

unread,
Jan 20, 2017, 12:52:42 AM1/20/17
to Angular
Hi mrjap1,

Have a look at the tutorial on the main angularjs page?

Regards
Sander

Nageswar Rao Kakolla

unread,
Jan 20, 2017, 11:44:02 AM1/20/17
to Angular
I guess you might not be including files properly as <script src="*.js"></script> which could be trivial issue and while breaking the file into multiple files, it is done incorrectly. I would do the steps again with care.

..Nag
Reply all
Reply to author
Forward
0 new messages