Angular: Passing Object to Directive
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<my-dir></my-dir>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('myDir', function () {
return {
restrict: 'E',
template: ['<div>',
'Hello, ',
'{{test}}!',
'</div>'].join(''),
};
});
myApp.controller('MyCtrl', function ($scope) {
$scope.test = "world";
});