Angularjs ng-bind Instruction
Angularjs instance
Binding <p> InnerHTML to variable myText:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="" ng-init="myText='Hello World!'">
<p ng-bind="myText"></p>
</div>
</body>
</html>
Run Result:
Hello world!
Definitions and usage
The ng-bind instruction tells Angularjs to replace the contents of the HTML element with the value of the given variable or expression.
If a given variable or expression is modified, the HTML element that specifies the substitution is also modified.
Grammar
<element ng-bind= "expression" ></element>
Or as a CSS class:
<element class= "Ng-bind:expression" ></element>
All HTML elements support this directive.
Parameter values
value |
Description |
Expression |
Specifies the variable or expression to execute. |
The above is the detailed introduction of Angularjs ng-bind instructions, there is a need for friends can refer to.