Angular 01

<script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
<div ng-app="Test" ng-controller="con">
    <input type="text" ng-model="input" />
    Hello {{input|B}}

    <div ng-controller="BC">
        <input type="text" ng-model="search.Name" />
        <table>
            <tr ng-repeat="item in Jsons|orderBy:'-id'|limitTo:2|filter:search">
                <td>{{item.id}}</td>
                <td>{{item.Name|lowercase}}</td>
            </tr>
        </table>
    </div>
    <superman></superman>
</div>

<script>
    var ng = new angular.module("Test", []);
    ng.factory("A", function () {
       
        return "hehe";
    });
    ng.filter("B", function () {

        return function (test)
        {
            return test + "1234";
        }
    })
    ng.controller("con", function ($scope,A) {
        $scope.input = A;

    });

    ng.factory("JS", function () {
        var array = [{ id: 2, Name: 'B' }, { id: 3, Name: 'C' }, { id: 1, Name: 'A' }];
        
        return array;

    })
    function BC($scope, JS) {
        $scope.Jsons = JS;

    }
    ng.directive("superman", function () {
        return {restrict:"E", template: "<p>my div2S</p>" };

    })
    

</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值