0

I've developed my first spa application in Angular js but I've done it on localhost.

Now it's time to test it online. I'm sure that everything works localy but simply I can't make it work online.

It seems to me like controllers are not being loaded although they are linked well. Routing works because html templates change but THERE ARE NO CONTROLLERS ???.

Here is sample output from console :

First,for every controller in my app I get this (total 5 times) :

Uncaught SyntaxError: Unexpected token <

And after that I get this for controller that is being used right now:

Error: [ng:areq] http://errors.angularjs.org/1.3.5/ng/areq?p0=homeCtrl&p1=not%20aNaNunction%2C%20got%20undefined
at Error (native)
at https://code.angularjs.org/1.3.5/angular.min.js:6:416

For every single controller I get the same error.

I followed rule to inject dependacys (found that on stackowerflow but it doesn't help at all) so my every controller looks like this:

myApp.controller('nearCtrl',
['$scope', 'geolocation', 'nearApartments', 'uiGmapGoogleMapApi',
    function ($scope, geolocation, nearApartments, uiGmapGoogleMapApi) {...}])

Does anyone have an idea what could I do to fix this ?

2
  • Can you make a fiddle? Commented Dec 13, 2014 at 20:26
  • Make a fiddle for his web server.... Commented Dec 13, 2014 at 20:28

3 Answers 3

1

Ok I found the solution,as usual it was trivial and now I feel like I shot myself in leg.

The thing was that I was very stupid and didn't follow good practices as NAMING CONVENTION from the BEGINING of the project !

In my index.html file there was an issue because few controllers were named by lowercase like myController.js and their real name on server was different like MyController.js so there's a problem.

I worked with git,merged branches and stuff and probabbly git messed up something with names(explains how it worked on localhost I guess) but that wouldn't happen if I had followed rules from the start.

To every wannabe Angular.js developer like me there are some great design guides and good practices described on link below.

Use them !

https://github.com/mgechev/angularjs-style-guide

Tnx everyone who tried to help me, Angular has really great community.

Sign up to request clarification or add additional context in comments.

Comments

0

The trouble is with your server routing. You're serving your whole app instead of the individual JS files. First thing you should do is make sure 188.226.150.65/app/components/about/aboutController.js serves correctly the JS for aboutController.js.

Comments

0

Looking at each of your component folders, it seems all your controller.js files all have the same error:

    Error in exception handler: The stream or file "/var/www/html/zimmer-
production/app/storage/logs/laravel.log" could not be opened: failed to open stream: 
    Permission denied in /var/www/html/zimmer-production/bootstrap/compiled.php:9016

The only controllers that seem to actually have any Javascript are the signup controllers and the apartmentControler. I'd check the permissions in your production environment, as that seems to be the problem.

2 Comments

Cool, well if it gets all figured out make sure to mark as answered so we can all rest easy :)
There's an answer It's ridiculously simple as usual, Now you can rest easy :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.