From ce84731d02d0986a1172e80e690b6601f8c00e32 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 3 Feb 2017 21:42:19 +0100 Subject: hello.component.js: Add a button that prints the name to the console Clicking on the button prints the current name to the console. Normally you wouldn't include the debug console in the controller scope, but this is here as an example to illustrate the action. The window isn't available to the controller's scope, it only includes what it defines on its scope. --- app/assets/javascripts/hello/hello.component.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/hello/hello.component.js b/app/assets/javascripts/hello/hello.component.js index 056cd39..366e5d5 100644 --- a/app/assets/javascripts/hello/hello.component.js +++ b/app/assets/javascripts/hello/hello.component.js @@ -5,9 +5,15 @@ .component('hello', { template: '

Hello {{ $ctrl.name }}

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