AngularJS学习笔记之TodoMVC的分析(3)


<!doctype html>
<html lang="en" ng-app="todomvc" data-framework="angularjs">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>AngularJS • TodoMVC</title>
        <link href="https://www.jb51.net/bower_components/todomvc-common/base.css">
        <style>[ng-cloak] { display: none; }</style>
    </head>
    <body>
        <section ng-controller="TodoCtrl">
            <header>
                <h1>todos</h1>
                <form ng-submit="addTodo()">
                    <input placeholder="What needs to be done?" ng-model="newTodo" autofocus>
                </form>
            </header>
            <section ng-show="todos.length" ng-cloak>
                <input type="checkbox" ng-model="allChecked" ng-click="markAll(allChecked)">
                <label for="toggle-all">Mark all as complete</label>
                <ul>
                    <li ng-repeat="todo in todos | filter:statusFilter track by $index" ng-class="{completed: todo.completed, editing: todo == editedTodo}">
                        <div>
                            <input type="checkbox" ng-model="todo.completed">
                            <label ng-dblclick="editTodo(todo)">{{todo.title}}</label>
                            <button ng-click="removeTodo(todo)"></button>
                        </div>
                        <form ng-submit="doneEditing(todo)">
                            <input ng-trim="false" ng-model="todo.title" todo-escape="revertEditing(todo)" ng-blur="doneEditing(todo)" todo-focus="todo == editedTodo">
                        </form>
                    </li>
                </ul>
            </section>
            <footer ng-show="todos.length" ng-cloak>
                <span><strong>{{remainingCount}}</strong>
                    <ng-pluralize count="remainingCount" when="{ one: 'item left', other: 'items left' }"></ng-pluralize>
                </span>
                <ul>
                    <li>
                        <a ng-class="{selected: location.path() == 'https://www.jb51.net/'} " href="#/">All</a>
                    </li>
                    <li>
                        <a ng-class="{selected: location.path() == '/active'}" href="#/active">Active</a>
                    </li>
                    <li>
                        <a ng-class="{selected: location.path() == '/completed'}" href="#/completed">Completed</a>
                    </li>
                </ul>
                <button ng-click="clearCompletedTodos()" ng-show="completedCount">Clear completed ({{completedCount}})</button>
            </footer>
        </section>
        <footer>
            <p>Double-click to edit a todo</p>
            <p>Credits:
                <a href="">Christoph Burgdorf</a>,
                <a href="">Eric Bidelman</a>,
                <a href="">Jacob Mumm</a> and
                <a href="">Igor Minar</a>
            </p>
            <p>Part of <a href="">TodoMVC</a></p>
        </footer>
        <script src="https://www.jb51.net/bower_components/todomvc-common/base.js"></script>
        <script src="https://www.jb51.net/bower_components/angular/angular.js"></script>
        <script src="https://www.jb51.net/js/app.js"></script>
        <script src="https://www.jb51.net/js/controllers/todoCtrl.js"></script>
        <script src="https://www.jb51.net/js/services/todoStorage.js"></script>
        <script src="https://www.jb51.net/js/directives/todoFocus.js"></script>
        <script src="https://www.jb51.net/js/directives/todoEscape.js"></script>
    </body>
</html>

首先是在最下面,引入相应的JS,这个就不多说了。

复制代码 代码如下:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgfjsd.html