angular.module('components', []) .directive('helloWorld', function () { return { restrict: 'E', scope:{ name:'bind' }, template: '<span>Hello {{name}}</span>' } }) angular.module('HelloApp', ['components'])
<!doctype html> <html ng-app="HelloApp"> <body> <hello-world name="John Lindquist"></hello-world> </body> </html>