• Angularjs 数据双向绑定


    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible"content="edge" />
    <meta name="viewport"content="width=device-width,initial-scale=1" />
    <title></title>
    <meta charset="utf-8" />
    <link rel="stylesheet"href="bootstrap/css/bootstrap.min.css" />
    <style>

    </style>
    </head>
    <body>
    <div class="container"style="padding:50px">
    <div data-ng-app="myApp"data-ng-controller="myCtrl">
    <p>姓名:<input type="text"data-ng-model="name" /></p>
    <p>性别:<input type="radio"data-ng-model="sex" value="男" name="sex"/>男<input type="radio"data-ng-model="sex" value="女" name="sex"/>女</p>
    <p>兴趣:<input type="checkbox"value="跑步" data-ng-model="interest1"/>跑步<input type="checkbox"value="羽毛球" data-ng-model="interest2"/>羽毛球<input type="checkbox"value="编程" data-ng-model="interest3"/>编程</p>
    <br /><hr />
    <fieldset>
    <legend>{{name}}:个人信息如下:</legend>
    <p>性别:{{sex}}</p>
    <p>兴趣:{{interest1}}{{interest2}}{{interest3}}</p>
    </fieldset>

    </div>


    </div>

    <script src="jQuery/jquery-2.2.0.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
    <script>
    angular.module("myApp", []).controller("myCtrl", function ($scope) {

    })
    </script>
    </body>
    </html>

  • 相关阅读:
    Java进阶10 内存管理与垃圾回收
    C编译: makefile基础
    Java基础09 类数据与类方法
    Java进阶06 容器
    C编译: 动态连接库 (.so文件)
    Java基础10 接口的继承与抽象类
    纸上谈兵: 左倾堆 (leftist heap)
    Java进阶02 异常处理
    Java进阶05 多线程
    Java基础12 类型转换与多态
  • 原文地址:https://www.cnblogs.com/melao2006/p/5116908.html
Copyright © 2020-2023  润新知