angular.module('myApp', []).controller('MyController', ['$scope', function($scope) { $scope.username = 'World';
$scope.sayHello = function() { $scope.greeting = 'Hello ' + $scope.username + '!'; // ← この時点で!! };}]);
<div ng-controller="MyController"> Your name: <input type="text" ng-model="username"> <button ng-click='sayHello()'>greet</button> <hr> {{greeting}}</div>