From 13eb4df71a2d304d13b37cfc15eac4c76870adce Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 3 Feb 2017 21:33:09 +0100 Subject: Add hello.component.js Create a new component for a Hello World example. This is housed in a new `n.Hello` module. For now, just print a hard-coded name to the page. Update the `n.Notes` module adding a dependency on `n.Hello` in order for our new component to be displayed. --- app/assets/javascripts/hello/hello.component.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/assets/javascripts/hello/hello.component.js (limited to 'app/assets/javascripts/hello') diff --git a/app/assets/javascripts/hello/hello.component.js b/app/assets/javascripts/hello/hello.component.js new file mode 100644 index 0000000..d1601f2 --- /dev/null +++ b/app/assets/javascripts/hello/hello.component.js @@ -0,0 +1,12 @@ +(function(angular) { + + angular + .module('n.Hello', []) + .component('hello', { + template: '

Hello {{ $ctrl.name }}

', + controller: function() { + this.name = 'World'; + } + }); + +})(window.angular); -- cgit v1.2.3