Angular入門小demo




	
		
		   demo
		
		
		var app=angular.module('myapp',[]);//     myapp   
			//     
			app.controller('myController',function($scope,$http){
				$scope.add=function(){
					return parseInt($scope.x)+parseInt($scope.y)
				};	
				
				$scope.sub=function(){
					$scope.z=parseInt($scope.x)*parseInt($scope.y)
				};	
				$scope.list= [100,192,203,434 ];//    
				$scope.listObject= [
				{name:'  ',shuxue:100,yuwen:93},
				{name:'  ',shuxue:88,yuwen:87},
				{name:'  ',shuxue:77,yuwen:56}
				];//      
				
				//    
				$scope.findAll=function(){
				$http.get('data.json').success(
				function(response){
				$scope.listResponse=response;
				}
				);
				};
				
			});
			
		
	
	
		{{100+100}}

	
    
    

{{myname}}


x:
y:

: {{add()}}
: {{z}}
{{x}}

{{entity.name}} {{entity.shuxue}} {{entity.yuwen}}


{{entityResponse.name}} {{entityResponse.shuxue}} {{entityResponse.yuwen}}

angular入门小demo_第1张图片
angular入门小demo_第2张图片