AngularJS Scope Object

by Hoang_Van_Trinh

HTML

<title>AngularJS Scope Object</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
    <script>
        angular.module('scopeExample', [])
        .controller('MyController', ['$scope', function($scope)
        {
            $scope.sayHello = function() {
              $scope.kkk = 'Xin chào ' + $scope.username + '!';
            };
        }]);
    </script>
<body ng-app="scopeExample">
    <div ng-controller="MyController">
        Nhập tên của bạn:
        <input type="text" value="Framgia" ng-model="username"></input>
        <button ng-click='sayHello()'>In thông báo</button>
        <hr />
        {{ kkk }}
    </div>
</body>