我正在学习AngularJS
,我正在玩弄依赖注入和内插。
我得到了开发工具以下两个错误中铬:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it.
Uncaught SyntaxError: Unexpected token (on line9 app.js
所以提到它明确指出,它无法找到该模块的第一个错误,我知道我已经corectly写它,并宣布index.html中的模块与data-ng-app="myApp"
(我喜欢确保我符合html标准,因此我使用数据前缀),并且在html标记中引用时显然不会被拼写错误。
这里是app.js:
和index.html:
<!DOCTYPE html>
<html lang="en" data-ng-app="myApp">
<head>
<script src="//code.angularjs.org/1.5.0-rc.0/angular.js"></script>
<script src="app.js"></script>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div data-ng-controller="mainController">
<label>What is your twitter handle? </label>
<input type="text" data-ng-model="handle"/>
<br/>
<h1>twitter.com/{{ lowercasehandle() }}</h1>
</div>
</body>
</html>
你可以从html
标记我曾引用看到 '对myApp' 在顶部html
标签模块。
至于与“意外的标记(”这是指这条线return $filter.('lowercase')($scope.handle);
我没有看到任何东西,是无效的第二个错误。
我知道我失去了一些东西,但我不能看到