1.文件
js目錄存放位置
2.helloworld.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HelloWorld</title>
<meta name="keywords" content="HelloWorld" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" name="viewport">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<script src="js/common/angular.min.js"></script>
<script src="js/common/angular-ui-router.min.js"></script>
</head>
<body ng-app>
<input type="text"
ng-model="name"
placeholder="Enter your name">
<h1>Hello {{name}}</h1>
</body>
</html>
3. 頁(yè)面展示
HelloWorld頁(yè)面展示
4. 解析
- ng-app: 表示啟動(dòng)AngularJS,并指定body歸AngularJS控制
- ng-model: 表示數(shù)據(jù)model層
- {{ }}: 花括號(hào)等同于ng-bind,屬于view層,將model層數(shù)據(jù)在此處渲染