Skip to content

Instantly share code, notes, and snippets.

@allenyang79
Created August 29, 2013 05:54
Show Gist options
  • Save allenyang79/6374646 to your computer and use it in GitHub Desktop.
Save allenyang79/6374646 to your computer and use it in GitHub Desktop.
angularjs ng-bind 測試
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app>
<div ng-controller="TextController">
ex1:<br/>
{{someText}}<br/>
ex2:<br/>
<span ng-bind="someText"></span><br/>
ex3:<br/>
<span ng-bind-html-unsafe="someHtml"></span><br/>
</div>
</body>
</html>
function TextController($scope){
$scope.someText = 'You have started your journey';
$scope.someHtml='<span style="color:#f00">bala</span><a onclick="alert(\'Hello\');">bala</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment