AngularJS学习笔记(2)——与用户交互的动态清单列表

与用户交互的动态清单列表

以我之前写的一个清单列表页面作为例子(MVC模式的清单列表效果),优化前代码如下:

<!DOCTYPE html>
<html ng-app="todoApp">
<head>
    <meta charset="UTF-8">
    <title>TO DO List</title>
    <link href="./bootstrap/css/bootstrap.css" rel="stylesheet"/>
    <link href="./bootstrap/css/bootstrap-theme.css" rel="stylesheet"/>
    <script src="./angularJs/angular.js"></script>
    <script>

        var model = {
            user:"Yimi",
            items:[{action:"练车",done:true},
                {action:"看课外书",done:false}]
        };

        var todoApp = angular.module("todoApp",[]);

        todoApp.controller("ToDoCtrl",function($scope){
      //以$开头的变量名表示AngularJS的内置特性
            $scope.todo = model;
        });

    </script>
</head>
<body ng-controller="ToDoCtrl">
    <div class="page-header">
        <h1>{
   {
   todo.user}}'s TO DO List</h1>
        <span class="label label-default">{
   {
   todo.items.length}}</span>
    </div>
    <div class="panel">
        <div class="input-group">
            <input class="form-control"/>
            <span class="input-group-btn">
                <button class="btn btn-default">Add</button>
            </span>
        </div>
        <table class="table table-striped">
            <thead>
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值