zoukankan      html  css  js  c++  java
  • Angularjs 事件指令

    1.  点击事件

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script type="text/javascript" src="angular.min.js"></script>
    </head>
    <body>
    <div ng-app="myApp">
    
        <div ng-controller="firstController">
            <div ng-click="run()">点击</div>
        </div>
    </div>
    <script type="text/javascript">
        var app = angular.module("myApp", []);
        app.controller('firstController',function($scope){
            $scope.text='phonegap中文网';
    
            $scope.run=function(){
    
                alert('run');
                console.log('run');
            }
        });
    </script>
    
    </body>
    </html>
    

      

    2. 样式 ng-class

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script type="text/javascript" src="angular.min.js"></script>
        <style>
            .red{background:red;}
            .yellow{background:yellow;}
        </style>
    </head>
    <body>
    <div ng-app="myApp">
    
        <div ng-controller="firstController">
            <div ng-click="run()">点击</div>
            <div ng-class="{red:true}">{{text}}</div>
        </div>
    </div>
    <script type="text/javascript">
        var app = angular.module("myApp", []);
        app.controller('firstController',function($scope){
            $scope.text='phonegap中文网';
    
            $scope.run=function(){
    
                alert('run');
                console.log('run');
            }
        });
    </script>
    
    </body>
    </html>
    

      

  • 相关阅读:
    c语言中strncpy函数
    c语言中字符串的复制
    c语言 11-6
    c语言 11-5
    c语言 11-4
    c语言中求字符串的长度
    c语言 11-3
    c语言中字符串的复制
    NOIP2006 金明的预算方案
    背包模型
  • 原文地址:https://www.cnblogs.com/linlf03/p/7137758.html
Copyright © 2011-2022 走看看