diff options
author | Teddy Wing | 2017-02-03 21:33:09 +0100 |
---|---|---|
committer | Teddy Wing | 2017-02-03 21:38:54 +0100 |
commit | 13eb4df71a2d304d13b37cfc15eac4c76870adce (patch) | |
tree | b14adf1040c439e148691467ff1b5f68496586bc /app/assets/javascripts/hello/hello.component.js | |
parent | 8dabdf87e992755d2a2bddb99a0c464917fd42d7 (diff) | |
download | Angular-tutorial-13eb4df71a2d304d13b37cfc15eac4c76870adce.tar.bz2 |
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.
Diffstat (limited to 'app/assets/javascripts/hello/hello.component.js')
-rw-r--r-- | app/assets/javascripts/hello/hello.component.js | 12 |
1 files changed, 12 insertions, 0 deletions
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: '<h2>Hello {{ $ctrl.name }}</h2>', + controller: function() { + this.name = 'World'; + } + }); + +})(window.angular); |