• 最近在研究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>

  • 相关阅读:
    mysql安装部署
    SSH升级
    符号、特殊字符的英文读法
    用python开发视频压缩器
    VSCode配置项
    工厂模式(简单工厂模式,工厂方法模式,抽象工厂模式)
    单例模式
    Jquery 绑定事件
    中文分词 新建索引 更新索引
    微信自动回复机器人
  • 原文地址:https://www.cnblogs.com/adam/p/3460124.html
Copyright © 2020-2023  润新知