<!DOCTYPE html>
<html lang="en" ng-app>
<head>
    <meta charset="UTF-8">
    <title>局部数据</title>
    <script src="js/jquery-1.11.3.min.js"></script>
    <script src="js/angular.min.js"></script>
    <script src="js/6.js"></script>
    <style>
        @charset"utf-8";

    </style>
</head>
<body>
    <div class="container" ng-controller="shuju">
    <div class="row">
            <div class="col-md-12 lin-height">ng-app 指令定义一个 AngularJS 应用程序。</div>
        </div>
        <div class="row">
            <div class="col-md-6 bind lin-height">ng-model 指令把元素值(比如输入域的值)绑定到应用程序</div>
            <div class="col-md-6 "><input type="text" class="form-control" ng-model="yonghu"></div>
        </div>
        <div class="row">
            <div class="col-md-4 bind lin-height">用户名</div>
            <div class="col-md-8 bind">
                <input type="text" class="form-control" ng-model="yonghu">
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 bind lin-height">一个子scope通常原型继承于它的父scope。应用于这个规则的表达式是一个使用scope:{...}的指令</div>
        </div>
        <div class="row">
            <div class="col-md-4 bind lin-height">ng-model="chuanshu.names"</div>
            <div class="col-md-8 bind">
                <input type="text" class="form-control" ng-model="chuanshu.names">
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 bind lin-height">ng-model="chuanshu.dan"</div>
            <div class="col-md-8 bind">
                <input type="text" class="form-control" ng-model="chuanshu.dan">
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 bind lin-height">通过函数计算表达式计算绑定的数据之间的关系</div>
        </div>
        <div class="row">
            <div class="col-md-4 bind lin-height">$scope.sum=function(){}</div>
            <div class="col-md-8 lin-height" style="color:red;font-size:28px">
                {{sum()}}
            </div>
        </div>

        <div class="row">
            <div class="col-md-12 lin-height">
                循环跨域去取数据渲染页面
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 lin-height">
                ng-init和ng-bind配合使用,封装数据和及时解析书籍
            </div>
        </div>
        <div class="row">
            <div class="col-md-12" ng-init="danjia=10;shu=20">
                <p ng-bind="danjia * shu"></p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12" ng-init="array=[1,2,3,4,5]">
                <p ng-bind="array[2]"></p>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 bind lin-height">循环打印出来的数据</div>
        </div>
        <div class="row">
            <ol ng-controller="text">
                <li ng-repeat="guojia in guojias">   {{$index+1}}----
                    {{guojia.cname}}----
                    {{guojia.renkou}}
                </li>
            </ol>
        </div>
        <div class="row">
            <div class="col-md-12 bind lin-height">很牛逼的数据绑定,不经过函数</div>
        </div>
        <div class="row" ng-init="qw=1;dw=3">
            <div class="col-md-6"><input type="text" class="form-control" ng-model="qw"></div>
            <div class="col-md-6"><input type="text" class="form-control" ng-model="dw"></div>
        </div>
        <div class="row">
            <div class="col-md-6">{{ qw * dw }}</div>
        </div>
        <div class="row">
            <div class="col-md-12 bind lin-height">$http 是一个用于读取web服务器上数据的服务。$http.get(url) 是用于读取服务器数据的函数</div>
        </div>
        <div class="row" ng-app="myApp">
            <ol ng-controller="customersCtrl">
                <li ng-repeat="x in names">
                {{ x.Name + ', ' + x.Country }}
                </li>
            </ol>
        </div>
        <div class="row">
            <div class="col-md-6">
                <a href="" name="myname"></a>
            </div>
            <div class="col-md-6">
                <a href="" name="myname"></a>
            </div>
        </div>
    </div>
</body>
</html>

上面的css部分就没有什么东西可说了!直接js了

    function shuju($scope,$timeout){
        $scope.chuanshu={
            names:38,
            dan:0
        };
        $scope.sum=function(){
            return $scope.chuanshu.names*$scope.chuanshu.dan;
        }
    };

        var text = function($scope){
                //alert(1);
                $scope.renkou = 7000;
                $scope.guojias =
                        [
                                {cname:'中国',renkou:1.1},
                                {cname:'日本',renkou:2.2},
                                {cname:'美国',renkou:3.3}
                        ];
                };

var app = angular.module('myApp', []);

app.controller('customersCtrl', function($scope, $http) {

  $http.get("http://localhost/de6.js").success(function (response) {$scope.names = response.records;});
});

angular.js的ng-app 指令定义一个 AngularJS 应用程序。的更多相关文章

  1. 定义一个共享数据块DB1 在DB1中定义一个数组 用程序 访问数据里面的某一个成员或者地址连续的成员

    提纲 : 定义一个共享数据块 DB1 在DB1 中定义数组 用SFC21 实现 实现全部数组元素的赋一样的值 实现 给数组中的某一个元素赋值 实现 对数组中的全部元素赋值 实现将数组中的某个 或者 某 ...

  2. 【AngularJS】—— 3 我的第一个AngularJS小程序

    通过前面两篇的学习,基本上对AngularJS的使用有了一定的了解. 本篇将会自己手动写一个小程序,巩固下理解. 首先要注意的是,引用AngularJS的资源文件angular.min.js文件. 由 ...

  3. angular学习笔记(三十)-指令(9)-一个简单的指令示例

    学了前面这么多关于指令的知识,现在就用指令来写一个小组件:expander 这个组件的功能就是点击开展菜单,再点击收起菜单: ↑↓点击展开收起 下面来看它的代码: html: <!DOCTYPE ...

  4. angular.js封装的树形指令

    html ul.tree-show sub-transclude-set ng-transclude li.parent(ng-repeat='(key,item) in treeData',ng-i ...

  5. 使用JavaScript定义一个微信小程序插件样例

    var wxTimer = new wxTimer({ beginTime: "00:00:20", complete: function () { wx.redirectTo({ ...

  6. Angular.js 学习笔记

    AngularJS 通过新的属性和表达式扩展了 HTML. AngularJS 可以构建一个单一页面应用程序. <!-- ng-app 指令定义一个 AngularJS 应用程序. ng-mod ...

  7. Angular JS 学习笔记(二)

    1. AngularJS 是一个 JavaScript 框架.它可通过 <script> 标签添加到 HTML 页面.AngularJS 通过 指令 扩展了 HTML,且通过 表达式 绑定 ...

  8. angular js 初学

    1 angularJS的一些概念 AngularJS 通过新的属性和表达式扩展了 HTML. AngularJS 是一个 JavaScript 框架,它是一个以Javascript编写的库,它可通过 ...

  9. Angular.JS学习笔记——1

    内容来自:http://www.runoob.com/angularjs/angularjs-intro.html AngularJS 是一个 JavaScript 框架.它是一个以 JavaScri ...

随机推荐

  1. MySQL常见建表选项以约束

    一.CREATE TABLE 选项 1.在定义列的时候,指定列选项 1)DEFAULT <literal>:定义列的默认值 当插入一个新行到表中并且没有给该列明确赋值时,如果定义了列的默认 ...

  2. 【lucene系列学习二】Lucene实现高亮显示关键词

    首先,导入下图所示库 然后,import org.apache.lucene.search.highlight.*; 下面,我们新建一个实现高亮显示功能的函数 public static String ...

  3. ubuntu下搭建nginx+mysql+php-fpm站点

    概述 Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器.  nginx的优势在于能以低内存高 ...

  4. python3 time模块与datetime模块

    time模块 在Python中,通常有这几种方式来表示时间:1)时间戳 2)格式化的时间字符串 3)元组(struct_time)共九个元素.由于Python的time模块实现主要调用C库,所以各个平 ...

  5. Linux上bash的部分基础特性:

    命令补全: tab shell程序在接收到用户执行命令的请求,分析完成后,最左侧的字符串会被当做命令 命令查找机制: 查找内部命令: 根据PATH环境变量中设定的目录,自左而右逐个搜索目录下的文件名 ...

  6. OOP 三大特点:继承性,封装性,多态性

    1.继承性:代码重用 2.封装性:  使相似数据和操作进行封装,保持代码安全 3.多态性:  PHP不支持多态

  7. Springboot基础篇

    Springboot可以说是当前最火的java框架了,非常适合于"微服务"思路的开发,大幅缩短软件开发周期. 概念 过去Spring充满了配置bean的xml文件,随着spring ...

  8. JDFS:一款分布式文件管理实用程序第一篇(线程池、epoll、上传、下载)

    一 前言 截止目前,笔者在博客园上面已经发表了3篇关于网络下载的文章,这三篇博客实现了基于socket的http多线程远程断点下载实用程序.笔者打算在此基础上开发出一款分布式文件管理实用程序,截止目前 ...

  9. 使用windows桌面ftp上传文件到linux服务器

    首先在linux服务器上安装ftp [root@host2 test]#yum -y install ftp vsftpd [root@host2 test]#service vsftpd start ...

  10. 5.Java 加解密技术系列之 DES

    Java 加解密技术系列之 DES 序 背景 概念 基本原理 主要流程 分组模式 代码实现 结束语 序 前 几篇文章讲的都是单向加密算法,其中涉及到了 BASE64.MD5.SHA.HMAC 等几个比 ...