[AngularJS]ng-bind-templateディレクティブのサンプル

構文
<要素 ng-bind-template="テンプレート式" ng-controller="xxx">
htmlコード

<head>
<meta charset="utf-8">
<script src="/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-bind-template="{{firstName}} {{lastName}}" ng-controller="myCtrl">
</div>

JavaScriptコード

<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
    $scope.firstName = "User";
    $scope.lastName = "Data";
});
</script>

 

AngularJS

Posted by arkgame