AngularJs-HelloWorld

AngularJs的简介和Hello World

AngularJs的简介

1、它是一个Js的框架
2、它现在有两个版本,第二个版本和第一个版本区别很大更侧重与适应移动端
3、它是一个MVVM框架,可以让你更专注于页面逻辑开发,用户数据驱动表现
4、它拥有路由、模块和控制器,更方便的开发单页应用SPA

Demo_v1.html

<!doctype html>
<html ng-app>
    <head>
        <!--声明当前页面的编码集:charset=gbk,gb2312(中文编码),utf-8国际编码-->
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <!--当前页面的三要素-->
        <title>AngularJS HelloWorld!</title>
        <meta name="Keywords" content="关键词,关键词">
        <meta name="description" content="">
        <!--  -->
        <link rel="Shortcut Icon" href="images/favicon.ico" type="image/x-icon" />
        <link type="text/css" href="iconfont/iconfont.css" rel="stylesheet"/>
        <link type="text/css" href="../../../../素材/css/Matrix.css" rel="stylesheet"/>
        <!--css,js-->
        <style type="text/css">
        *{
            margin:0;
            padding:0;
        }
        body{
            font-size:12px;
            font-family:"微软雅黑";
            background:linear-gradient(90deg,#1d3746,#4D3648);
            height:2205px;
        }
        .wrapper{
            width:500px;
            height:500px;
            margin:100px auto;
        }
        #showButton{
            display: inline-block;
            padding:8px 69px;
            background:#C2A84A;
            color:#fff;
            font-size:12px;
            border-radius:5px;
        }
        #showButton:hover{
            background:#EDE176;
            color:#000;
            transition:all 0.3s linear;
        }
        #showButton2{
            display: inline-block;
            padding:8px 69px;
            background:#C2A84A;
            color:#fff;
            font-size:12px;
            border-radius:5px;
        }
        #showButton2:hover{
            background:#EDE176;
            color:#000;
            transition:all 0.3s linear;
        }
        input[type="text"]{
            background:#252525;
            outline:none;
            border-radius: 5px;
            border:1px solid #252525;
            padding:6px 18px;
        }
        ul li{
            margin:10px 0px;
        }
        </style>
    </head>
<body>

    <div class="wrapper">
        <h1>AnagularJs模式</h1>
        <ul>
          <li>姓:<input type="text"  ng-model="xing"/></li>
          <li>名:<input type="text"  ng-model="ming"/></li>
          <li><b>{{xing || ''}} {{ming || ' ' }}</b></li>
          <li><a href="#" id="showButton2">输出姓名</a></li>
        </ul>
        <h1>传统模式</h1>
        <ul>
          <li>姓:<input type="text" id="xingInput" /></li>
          <li>名:<input type="text" id="mingInput" /></li>
          <li><b id="nameView">Hello</b></li>
          <li><a href="#" id="showButton">输出姓名</a></li>
        </ul>
    </div>

    <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="js/angular-1.0.1.min.js"></script>
    <script type="text/javascript">
         var xing = document.getElementById("xingInput");
         var ming = document.getElementById("mingInput");

         var showButton = document.getElementById("showButton");
         showButton.onclick = function(){
            var name = xing.value + " " + ming.value;
            var nameView = document.getElementById("nameView");
            nameView.innerHTML = name;
            // $("#nameView").text(name);
            return false;
         }
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值