简体   繁体   English

包含控制器后,AngularJS停止工作

[英]AngularJS stops working as soon as I include a controller

I'm trying to learn AngularJS and I'm running into a road block. 我正在尝试学习AngularJS,但遇到了障碍。 As soon as I include a controller on my form tag, any remaining angular JS stops functioning. 一旦我在表单标签上包含一个控制器,所有剩余的有角JS就会停止运行。

eg: 例如:

start {{ 1 + 1 }}
<form id="contact-form" ng-controller="messagingController">
</form>
end {{ 1 + 1 }}

What I will see is: 我将看到的是:

start 2
end {{ 1 + 1 }}

I have ng-app on the body tag. 我的身体标签上有ng-app。 I have angular script included at the top of my page. 我的页面顶部包含了角度脚本。 I include a js for the controller 我为控制器添加了一个js

If you need to see the entire source, just go to http://tatmanblue.com/ . 如果需要查看整个源代码,请访问http://tatmanblue.com/ Scroll to the bottom. 滚动到底部。

Any ideas what is wrong? 任何想法有什么问题吗?

Thnx Matt Thnx马特

在body标签中,您需要使用ng-app编写模块名称

<body ng-app="messagingForm" ...

请在这里查看https://docs.angularjs.org/error/ng/areq?p0=messagingController&p1=not%20a%20function,%20got%20undefined ,这意味着没有函数messagementController,您错过了控制器的js

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

相关问题 angularJS-添加ngRoute时控制器停止工作 - angularJS - controller stops working when I add ngRoute 添加html内容后,轮播会停止工作 - Carousel stops working as soon as html content is added 只要再添加1个变量,函数就会停止工作? 根据像素颜色为图像添加边界 - Function stops working as soon as I add 1 more variable? Adding boundaries to image based off pixel color $(document).ready(function()在为变量赋值时立即停止工作(var userid = $ {userid};) - $(document).ready(function() stops working as soon as i assign value to variable ( var userid = ${userid}; ) 在AngularJS 1.2中,如何为ng-include指定控制器? - In AngularJS 1.2, how do I specify the controller for an ng-include? 如何在AngularJS控制器中包含脚本? - How do I include scripts in my AngularJS controller? 一旦Rx中发生错误,ValueChanges就会停止工作。 - ValueChanges stops working as soon as an error occurs in an Rx.Observable Javascript验证无法正常工作-只要if语句为真,它就会停止所有if语句? - Javascript validation is not working - as soon as one if statement is true, it stops all if statements? AngularJS模态服务停止工作 - AngularJS Modal Service Stops Working ng-include中的Angularjs控制器 - Angularjs controller in ng-include
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM