[英]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.