码迷,mamicode.com
首页 > Web开发 > 详细

AngularJs Test demo

时间:2016-07-14 15:17:04      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script src="scripts/angular.js"></script>
</head>
<body ng-app="app" ng-controller="cur">
    how are you!
    <div>
        <input type="text" ng-model="name" />
        {{name}}
        <button ng-click="pop(this)">pop</button>
    </div>
    <ul>
        <li ng-repeat="num in list">{{num}}</li>
    </ul>
    <select>
        <option ng-repeat="no in select" value="{{no}}">{{no}}</option>
    </select>
    <div ng-show="show()">ng show test</div>
    <div ng-show="show1">ng show test boolean</div>
    <script>
        var app = angular.module(‘app‘, []);
        app.controller(‘cur‘, function ($scope) {
            $scope.name = ‘test‘;
            $scope.list = [1, 2, 3, 4];
            $scope.select = [4, 3, 2, 1];
            $scope.pop = function (obj) {
                //alert(obj);
                alert($scope.name);
            }
            $scope.show = function () {
                return false;
            };
            $scope.show1 = true;
        });
    </script>
</body>
</html>

 

AngularJs Test demo

标签:

原文地址:http://www.cnblogs.com/hualiu0/p/5670280.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!