我一直在使用Sublime作为编辑器,并且一直在编辑引用Angular JS脚本的HTML文件。我已经从" Package Control:Install Package"下载了Angular JS软件包。选项,并启用了浏览器,以便我可以在启动时查看我在Chrome中的工作。我一直在使用本网站的教程:http://learn-angular.org/#!/lessons/the-essentials,并且一直在使用课程练习中的代码并将它们放入我的崇高编辑器中,它似乎并没有承认Angular脚本。
这是我正在使用的代码示例"双向绑定" (http://learn-angular.org/#!/lessons/two-way-bindings):
<!doctype html>
<html ng-app>
<head>
<title>My Angular App</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body>
<div ng-controller="index">
<div>
Favorite word: <input type="text" ng-model="favoriteWord" />
- {{favoriteWord}}
</div>
<div>
Favorite color:
<input type="radio" name="fc" value="Red" ng-model="favoriteColor">Red</input>
<input type="radio" name="fc" value="Green" ng-model="favoriteColor">Green</input>
<input type="radio" name="fc" value="Yellow" ng-model="favoriteColor">Yellow</input>
<input type="radio" name="fc" value="Blue" ng-model="favoriteColor">Blue</input>
- {{favoriteColor}}
</div>
<div>
Favorite shape:
<select ng-model="favoriteShape">
<option value="Circle">Circle</option>
<option value="Triangle">Triangle</option>
<option value="Square">Square</option>
</select>
- {{favoriteShape}}
</div>
</div>
<script type="text/javascript">
angular.module("root", [])
.controller("index", ["$scope", function($scope) {
$scope.favoriteWord;
$scope.favoriteColor;
$scope.favoriteShape;
}]);
</script>
</body>
</html>
但是当放入Sublime时,它不会识别控制器并将其绑定到视图。我究竟做错了什么?这是我的代码设置还是编辑器出错了?