From d3c979fa6fb27b2967b3a0064ee701bea76e148e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 4 Nov 2014 16:02:36 -0800 Subject: [PATCH] [Example] Add example using directives Add example of binding a directive with Angular using declarative syntax. WTD-518. --- example/builtins/bundle.json | 5 ++++- example/builtins/res/templates/example.html | 3 ++- example/builtins/src/ExampleDirective.js | 23 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 example/builtins/src/ExampleDirective.js diff --git a/example/builtins/bundle.json b/example/builtins/bundle.json index d43a659de8..c8dfc9a4ce 100644 --- a/example/builtins/bundle.json +++ b/example/builtins/bundle.json @@ -10,7 +10,10 @@ } ], "directives": [ - + { + "key": "exampleDirective", + "implementation": "ExampleDirective.js" + } ], "routes": [ { diff --git a/example/builtins/res/templates/example.html b/example/builtins/res/templates/example.html index 8323a4f7c9..ad411dca35 100644 --- a/example/builtins/res/templates/example.html +++ b/example/builtins/res/templates/example.html @@ -1,2 +1,3 @@

Hello, world! I am the default route.

-

My controller has told me: "{{phrase}}"

\ No newline at end of file +

My controller has told me: "{{phrase}}"

+ \ No newline at end of file diff --git a/example/builtins/src/ExampleDirective.js b/example/builtins/src/ExampleDirective.js new file mode 100644 index 0000000000..ce69d4a78d --- /dev/null +++ b/example/builtins/src/ExampleDirective.js @@ -0,0 +1,23 @@ +/*global define,Promise*/ + +/** + * Module defining ExampleDirective. Created by vwoeltje on 11/4/14. + */ +define( + [], + function () { + "use strict"; + + /** + * + * @constructor + */ + function ExampleDirective() { + return { + template: "And this came from a directive." + }; + } + + return ExampleDirective; + } +); \ No newline at end of file