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

    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index6</title>
        <script type="text/javascript" src="~/Scripts/angular.js"></script>
        <script src="~/Scripts/angular-sanitize.js"></script>
    </head>
    <body>
        <div ng-app="myApp">
            <div ng-controller="firstController">
                <div ng-bind="text">ng-bind只能绑定一个</div>
                <div ng-bind-template="{{text}}{{name}}">ng-bind-template可以绑定多个</div>
                <div  ng-bind-html="h2">ng-bind-html 依赖sanitize插件依赖ngSanitize也可以通过使用$sce服务</div>
                <div ng-bind-html="detailContent()"></div>
                <div ng-repeat="innerList in list" ng-init="outerIndex=$index">
                    <div ng-repeat="value in innerList" ng-init="innerIndex=$index">
                        <span>list[{{outerIndex}}][[{{innerIndex}}]]={{value}}; </span>
    
                    </div>
                </div>
                <div>
                    <input type="text" ng-model="name" ng-model-options="{updateOn:'blur'}" />
                    {{name}}
    
                </div>
            </div> 
        </div>
        <script type="text/javascript">
            var app = angular.module("myApp", ['ngSanitize']);
            app.controller("firstController", function ($scope,$sce) {
                $scope.text = "PhoneGap中文网";
                $scope.name = "张三";
                $scope.h2 = "<h2>这是H2</h2>";
                $scope.detailContent = function () {
                    return $sce.trustAsHtml("<H1>使用ng的$sce来解析HTML</H1>");//记得写return
                };
                $scope.list = [['a','b'],['c','d']];
            });
    
        </script>
    </body>
    </html>
    

      

  • 相关阅读:
    commands.getstatusoutput和subprocess.call结果不一致
    win10 企业版 2015 长期服务激活
    pycharm设置护眼模式
    实战--滚动菜单
    javascript中this的用法
    jQuery之remove与empty的区别
    clone方法案例实践
    jQuery内部插入与外部插入
    jQuery文档处理
    2020/02/11星期二复习
  • 原文地址:https://www.cnblogs.com/sumg/p/5605347.html
Copyright © 2011-2022 走看看