• 最近在研究google的angularjs


     最近在研究google的angularjs,先做个简单的例子来试试。

     
    <!doctype html>
    <html lang="en" ng-app="myApp">
    <head>
        <meta charset="utf-8">
        <title>parent demo</title>
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="scripts/libs/angular.min.js"></script>
    </head>
    <body>
    
    <div ng-controller="TextController"><p ng-bind="someText.message"></p></div>
    
    <div class="selected"><div><p class="ag">Hello Again</p></div></div>
    
    <form ng-controller="SomeController">
        <input type="checkbox" ng-model="youCheckedIt" />
        <input type="button" ng-click="checkedIt()" value="Click" />
    </form>
    <script>
        var myAppModule=angular.module('myApp', []);
        myAppModule.controller('TextController', function($scope){
           var someText = {};
            someText.message = 'You have started your journey.';
            $scope.someText = someText;
        });
    
        myAppModule.controller('SomeController', function($scope){
            $scope.youCheckedIt=true;
            $scope.checkedIt = function(){
                alert($scope.youCheckedIt);
                $scope.youCheckedIt=false;
            };
        });
    </script>
    
    <script>
        console.log($( "p.ag" ).parents("div").length);
        $( "p.ag" ).parents("div").css( "background", "yellow" );
    </script>
    
    
    </body>
    </html>

  • 相关阅读:
    安全管道工具SSF
    Dumpzilla工具第615行bug的解决办法
    火狐浏览器信息提取工具Dumpzilla
    通过构造函数来创建新对象
    利用canvas绘制序列帧动画
    canvas的图片绘制案例
    使用canvas绘制饼状图
    模仿制作京东的侧边提示栏
    使用canvas绘制扇形图
    使用canvas制作简单表格
  • 原文地址:https://www.cnblogs.com/adam/p/3460124.html
Copyright © 2020-2023  润新知