Skip to content

Instantly share code, notes, and snippets.

@madwork
Created Sep 9, 2015
Embed
What would you like to do?
Angular 1.3 Bind Once
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bind Once</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.13/angular-sanitize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.13/angular.min.js"></script>
</head>
<body ng-app>
<p><input type="text" ng-model="foo"></p>
<p>ngBindHtml: <span ng-bind-html="foo"></span></p>
<p>ngBind: <span ng-bind="foo"></span></p>
<p>expression: {{foo}}</p>
<p>expression (bind once): {{::foo}}</p>
<p>ngIf: <span ng-if="foo">FOO!</span></p>
<p>ngIf (bind once): <span ng-if="::foo">FOO!</span></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment