AngularJS ng-class

test.html 页面




	Angular.js
	
	
	


	
{{messagetext}}

test.js

function WEController($scope){
	$scope.isError = false;
	$scope.isWarning = false;

	$scope.warn = function(){
		$scope.messagetext = "this is warning text";
		$scope.isWarning = true;
		$scope.isError = false;
	};

	$scope.error = function(){
		$scope.messagetext = "this is error text";
		$scope.isWarning = false;
		$scope.isError = true;
	}
}
初始画面


点击showError



点击showWarn



你可能感兴趣的:(AngularJS,AngularJs)