zoukankan      html  css  js  c++  java
  • 初入angularJS [1]

    html
    <!doctype html>
    <html ng-app>
    <head>
        <link  rel="stylesheet" href="todo.css" />
        <link rel="stylesheet" href="bootstrap.min.css" />
        <script src="./angular-1.0.1.min.js"></script>
        <script src="./todo.js"></script>
    
    </head>
    <body>
    
    <div ng-controller="TodoCtrl">
        <h2>Total todos:{{getTotalTodos()}} </h2>
        <ul class="unstyled">
            <li ng-repeat="todo in todos">
                <input type="checkbox"  ng-model="todo.done"/>
                <span class="done-{{todo.done}}">{{todo.text}}</span>
            </li>
        </ul>
        <form class="form-horizontal">
            <input type="text" ng-model="formTodoText" ng-model-instant />
            <button class="btn" ng-click="addTodo()"><i class="icon-plus"></i>Add </button>
        </form>
    </div>
    </body>
    </html>
    View Code
    css
    1 .done-true{
    2    text-decoration: line-through;
    3    color: gray;
    4 }
    View Code
    js
     1 function TodoCtrl($scope){
     2     $scope.totalTodos=4;
     3 
     4     $scope.todos=[
     5         {text:"Learn AngularJS",done:false},
     6         {text:"Build an app",done:false}
     7     ];
     8 
     9     $scope.getTotalTodos=function(){
    10         return $scope.todos.length;
    11     };
    12 
    13 
    14     $scope.addTodo=function(){
    15         $scope.todos.push({text:$scope.formTodoText,done:false});
    16         $scope.formTodoText="";
    17     };
    18 }
    View Code
  • 相关阅读:
    Android OpenGL 编写简单滤镜
    linux 文件系统
    此博客不再更新
    golang sync包
    KADEMLIA算法
    golang 类型转换
    golang 小例子
    go-ehtereum编译:
    golang编译库文件方式
    以太坊(Ethereum)智能合约NodeJS/Web3 使用
  • 原文地址:https://www.cnblogs.com/yuluhuang/p/3499566.html
Copyright © 2011-2022 走看看