AngularJS ng-bind-template Directive

Definition and Usage

ng-bind-template Directive tells AngularJS to replace the content of the HTML element with the value of the given expression.

Use when you want to bind multiple expressions to an HTML element: ng-bind-template Directive.

Example

Bind to to <p> element:

<div ng-app="myApp" ng-bind-template="{{firstName}} {{lastName}}" ng-controller="myCtrl"></div>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
    $scope.firstName = "Bill";
    $scope.lastName = "Gates";
});
</script>

Prøv det selv

Syntaks

<element ng-bind-template="udtryk</element>

Alle HTML-elementer understøtter.

Parameter

Parameter Beskrivelse
udtryk At beregne en eller flere udtryk, hvor hver udtryk er omgivet af {{ }}.