标签:color angularjs [] 分享 use over span $scope html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <div ng-app="myApp"> <div ng-controller="firstController"> <button ng-click="changeStatus($event)">切换状态</button> {{status}} </div> </div> <script type="text/javascript" src="../../vendor/angular/angularjs.js"></script> <script type="text/javascript" src="app/index.js"></script> </body> </html>
var myApp = angular.module(‘myApp‘,[]) .controller(‘firstController‘,function ($scope) { $scope.status = ‘false‘; // $scope.changeStatus = function () { // $scope.status = !$scope.status; // } $scope.changeStatus = function (event) { //通过 element 转换成 jquery 对象 angular.element(event.target).html(‘转换状态为:‘ + $scope.status); $scope.status = !$scope.status; } });
标签:color angularjs [] 分享 use over span $scope html
原文地址:http://www.cnblogs.com/bky-1083/p/6358698.html