1.最简单的Hello,World
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body ng-app="start">
<div ng-controller="helloworldController">
<p>{{greeting.text}},World</p>
</div>
<script type="text/javascript">
angular.module('start',[])
.controller('helloworldController',function($scope){
$scope.greeting={
text:'Hello'
}
})
</script>
</body>
</html>
2.ng-model Hello,World
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body ng-app="start">
<div ng-controller="helloworldController">
<input type="text" ng-model="greeting.text"></input>
<p>{{greeting.text}},World</p>
</div>
<script type="text/javascript">
angular.module('start',[])
.controller('helloworldController',function($scope){
$scope.greeting={
text:'Hello'
}
})
</script>
</body>
</html>