diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc
index 1bd793ced5a8..2f5730d0c61f 100644
--- a/docs/content/guide/directive.ngdoc
+++ b/docs/content/guide/directive.ngdoc
@@ -282,6 +282,46 @@ using `templateUrl` instead:
+`templateUrl` can also be expressed as a function which should return the location of the html template
+you would like to load in dynamically for the directive. The function is passed the element the directive
+was called on as well as any attributes attached to that element.
+
+
+**Note:** You do not currently have the ability to access scope variables from the `templateUrl` function,
+as the template is requested before the scope has initialized.
+
+
+
+
+ angular.module('docsTemplateUrlDirective', [])
+ .controller('Controller', ['$scope', function($scope) {
+ $scope.customer = {
+ name: 'Naomi',
+ address: '1600 Amphitheatre'
+ };
+ }])
+ .directive('myCustomer', function() {
+ return {
+ templateUrl: function(elem, attr){
+ return 'customer-'+attr.type+'.html';
+ }
+ };
+ });
+
+
+
+
+
+ Name: {{customer.name}}
+
+
+ Address: {{customer.address}}
+
+
+
**Note:** When you create a directive, it is restricted to attribute and elements only by default. In order to
create directives that are triggered by class name, you need to use the `restrict` option.