zoukankan      html  css  js  c++  java
  • AngularJs练习Demo5

    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index5</title>
        <script type="text/javascript" src="~/Scripts/angular.js"></script>
        <style>
            .red {
                background: red;
                color: blue;
            }
    
            .yellow {
                background: yellow;
            }
        </style>
    </head>
    <body>
        <div ng-app="myApp">
            <div ng-controller="firstController">
                <div ng-class="{red:s,yellow:true}" ng-cloak>{{text}}</div>
                <div ng-class="{sClass}" ng-cloak>{{text}}</div>
                <div ng-cloak ng-style="{color:'red'}"></div>
                <div ng-cloak ng-style="{sStyle}"></div>
                <a href="{{url}}">百度</a><br />
                <a ng-href="{{url}}"></a><br />
                <img src="{{src}}" /><br />
                <img ng-src="{{src}}" /><br />
                <a ng-href="{{url}}" title="百度" ng-attr-title="{{text}}"></a>
    
                <div ng-show="t">ng-show绑定变量不需要{{}}用的是display的操作</div>
    
                <div ng-if="t">ng-if是dom级的操作直接删除dom</div>
    
                <div ng-switch on="t">
                    <p ng-switch-default>默认效果</p>
                    <p ng-switch-when="false">切换的效果
                     </p>
                    <p ng-switch-when="true">
                        切换的效果
                    </p>
                </div>
                <div ng-switch on="selection">
                    <div ng-switch-when="settings">Settings Div</div>
                    <div ng-switch-when="home">Home Span</div>
                    <div ng-switch-default>Default</div>
                </div>
                <input type="checkbox" ng-model="open"/>
                <details id="details" ng-open="open">
                    <summary>Show/Hide me</summary>
                </details>
    
            </div>
        </div>
        <script type="text/javascript">
            var app = angular.module("myApp", []);
            app.controller("firstController", function ($scope) {
                $scope.text = "PhoneGap中文网";
                $scope.s = true;
                $scope.sClass = "{red:true,yellow:true}";
                $scope.sStyle = "{color:'red',background:'yellow'}";
                $scope.url = 'htttp://www.baidu.com';
                $scope.src = "";
                $scope.t = true;
                $scope.items = ['settings', 'home', 'other'];
                $scope.selection = $scope.items[0];
            });
        </script>
    </body>
    </html>
    

      

  • 相关阅读:
    # ConfigureAwait常见问题解答
    # Oracle 常用语句
    # C# 中的Task创建指南
    ASP.NET Core Web API 跨域(CORS) Cookie问题
    Order by 优化
    VMware 安装 CentOS 7
    ThreadLocal 内存泄漏问题深入分析
    Zookeeper 如何保证分布式系统数据一致性
    Redis 5.0 安装
    Redisson 实现分布式锁的原理分析
  • 原文地址:https://www.cnblogs.com/sumg/p/5605344.html
Copyright © 2011-2022 走看看