Angular.js: erstellen von controller-Modul?

Möchte ich definieren einen controller beim verwenden des Moduls:

angular.module('todoList', [], function () {

}).controller('myCtrl', function ($scope) {
    return function ($scope) {
        $scope.todos = [
            {
                text: "Hello"
            }, {
                text: "World"
            }
        ]
    }

})

dann möchte ich das Modul und die ccontroller:

<div ng-controller="myCtrl" ng-app="todoList">  
        <li ng-repeat="todo in todos">
            <span>{{todo.text}}</span>
        </li>>
</div>

aber es render nichts, was ist falsch an meinem code?

InformationsquelleAutor hh54188 | 2013-04-01

Schreibe einen Kommentar