<body style="padding: 10px;" ng-app="app">
<div ng-controller="MyCtrl">
<h1>{{realname}}</h1>
<h1>{{http}}</h1>
<h1>{{data.msg}}</h1>
<h1>{{uName}}</h1>
</div>
</body>
<script src="js/angular.min.js"></script>
<script>
angular.module('app', [])
.value("realname","niefee")//value值可以改变的。
.value("realname","Muling")
.constant('http', "www.baidu.com")//constant不可以改变。
.constant('http', "www.qq.com")
.factory("Data",function(){
return {
msg:'hello',
setMsg:function(){
this.msg="我不好的";
}
}
})
.service("User",function(){
this.firstname="上官";
this.lastname="飞燕";
this.getName=function(){
return this.firstname+this.lastname;
}
})
.controller('MyCtrl', function($scope,realname,http,Data,User){
$scope.msg="hello";
$scope.realname=realname;
$scope.http=http;
$scope.data=Data;
$scope.uName=User.getName();
Data.setMsg();
})
</script>
<img ng-src="{{user.icon}}" ng-show="user.isShowImg" ng-class="{'tx':user.showicon}">
<img ng-src="{{user.icon}}" ng-hide="user.isShowImg" ng-class="{'tx':user.showicon}">
<img ng-src="{{user.icon}}" ng-ig="user.isShowImg" ng-class="{'tx':user.showicon}">
<button type="submit" class="button expand" ng-disabled="f.$invalid">提交</button>
<li ng-repeat="a in list">
<h4>{{a.address}}</h4>
</li>