aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts/hello/hello.component.js
blob: 366e5d5e8b1738c3ad5a53ee8d790ecc11d57187 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(function(angular) {

    angular
        .module('n.Hello', [])
        .component('hello',  {
            template:
                '<h2>Hello {{ $ctrl.name }}</h2>' +
                '<div>' +
                    '<input type="text" ng-model="$ctrl.name" />' +
                '</div>' +
                '<div>' +
                    '<button ng-click="$ctrl.console.log($ctrl.name)">Print to console</button>' +
                '</div>',
            controller: function() {
                this.name = '';
                this.console = window.console;
            }
        });

})(window.angular);