简体   繁体   English

Angular JS控制器无响应

[英]Angular JS Controller Not Responding

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. 出于某种原因,chatController.js上的控制器无法正常工作,因为当我专门告诉它在处于聊天状态时发出警报时,却没有。 Here is the plunker: https://plnkr.co/edit/ycpJmsIKJaKlcpoUma43?p=preview 这是the人: https ://plnkr.co/edit/ycpJmsIKJaKlcpoUma43 ? p = preview

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

Here is the chatController.js file: 这是chatController.js文件:

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

在plunker上,您有两个带有“ chatController”的文件(chatController.js和userSettingController.js),您必须更改其中一个名称,因为如果您有两个具有相同名称的控制器,则一个将覆盖第二个。

chatController is defined twice. chatController被定义了两次。 First in Controllers/chatController.js and then in Controllers/userSettingsController.js 首先在Controllers / chatController.js中,然后在Controllers / userSettingsController.js中

both are linked in index.html 两者都链接在index.html中

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

您已经在userSettingsContoller.js中定义了chatController

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM