我想在使用模块时定义一个控制器:
- angular.module('todoList',[],function () {
- }).controller('myCtrl',function ($scope) {
- return function ($scope) {
- $scope.todos = [
- {
- text: "Hello"
- },{
- text: "World"
- }
- ]
- }
- })
那么我想使用该模块和ccontroller:
- <div ng-controller="myCtrl" ng-app="todoList">
- <li ng-repeat="todo in todos">
- <span>{{todo.text}}</span>
- </li>>
- </div>
但是它什么也没有,我的代码怎么了?