index.html:
{
{1+1}}2
- 当前元素:{ {$index}}{ {city}} 是否为头元素:{ {$first}} 是否为非头非尾元素:{ {$middle}} 是否为尾元素:{ {$last}}
{
{status}}你好你好吗
- true
- false
other.html:
HI 另一个页面
index.js:
var myApp = angular.module('myApp', []).controller('firstController',function ($scope) { $scope.status = false; $scope.changeStatus = function (event) { console.log(event.target); $scope.status = !$scope.status; //angular.element把angular元素转换为jquery元素 angular.element(event.target).html('切换状态'+$scope.status); } $scope.defaultStyle = { color:'red', 'margin-top':'50px' } $scope.src = "http://www.angularjs.org/img/AngularJS-large.png";})
运行结果: