0

For some reason the controller on chatController.js is not working, since when i told it specifically to alert when it is in the Chat but it didnt. Here is the plunker: https://plnkr.co/edit/ycpJmsIKJaKlcpoUma43?p=preview

And Cloud9: https://ide.c9.io/amanuel2/chattapp

Here is the chatController.js file:

app.controller('chatController', ["$scope", function($scope) {
   alert("Works???");
}
]);
5
  • 1
    regController controller is not defined.. Commented Jan 19, 2016 at 13:35
  • regController?? Yes it is look at my cloud9.. Commented Jan 19, 2016 at 13:37
  • @GREE Look at your console, thats the error which is reported. Commented Jan 19, 2016 at 13:38
  • Nvm @PankajParkar i added the regController now lol Commented Jan 19, 2016 at 13:38
  • It was on my cloud9 @Curt i forgot to copy it to my plunker. Sorry Commented Jan 19, 2016 at 13:38

4 Answers 4

2

On plunker you have got two file with 'chatController' (chatController.js and userSettingController.js) you must change name one of them because if you have got two controller with this same name then one will override the second one.

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

1 Comment

Thier not the same name....... userSettingController and chatController is diffrent
1

chatController is defined twice. First in Controllers/chatController.js and then in Controllers/userSettingsController.js

both are linked in index.html

<script src = "Controllers/chatController.js"></script>
<script src = "Controllers/userSettingsController.js"></script>

2 Comments

I see a userSettingsController in userSettingsController.js, not a chatController.
Controllers are recognized by name. You have 2 controllers defined with this same name and first is redefined by second one. Go to userSettingsController and change it's name from chatController to something else.
1

You have chatController already defined in userSettingsContoller.js

Comments

-1

try app.controller('chatController', function($scope) { alert("Works???"); });

2 Comments

This is just a similar version of the same script, which won't work when minified.
@Curt I thought GREE had problems injecting the scope.. GREE it has nothing to do with the controller then..

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.