angularJS 练习

前端之家收集整理的这篇文章主要介绍了angularJS 练习前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

学习地址:http://www.runoob.com/angularjs/angularjs-tutorial.html

<!doctype html>
<html lang="en">
 <head>
  <Meta charset="UTF-8">
  <Meta name="Generator" content="EditPlus®">
  <Meta name="Author" content="cloud">
  <Meta name="Keywords" content="angularJS web 前端">
  <Meta name="Description" content="">
  <title>angularJs练习</title>
 
	<script src = "https://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
 </head>
 <body>
	<!-- angular 值绑定 -->
	<div ng-app = "user_name_app" ng-controller = "user_name_controller">
		姓: <input type="text" ng-model="f_name"><br>
		名: <input type="text" ng-model="l_name"><br>
		
		<!-- angular 表达式 -->
		<div>
			姓名: {{f_name + l_name}}
		</div>
	
		<!-- angular 表达式 -->
		<div ng-init="quantity=1;cost=5">
			{{ quantity * cost }}
		</div>

		<!-- angular 表达式 -->
		{{1 + 1}}

		<!-- angular 表达式 -->
		<div ng-init="points=[1,15,19,2,40]">
			{{ points[0]}}
		</div>
	</div>
	
	<!-- angular 脚本 -->
	<script>
		var app = angular.module('user_name_app',[]);
		app.controller('user_name_controller',function($scope) {
			$scope.f_name= "china";
			$scope.l_name= "cloud";
		});
	</script>
 </body>
</html>
原文链接:https://www.f2er.com/angularjs/148105.html

猜你在找的Angularjs相关文章