AngularJS - Sample Interview Question (Junior Level)

Considering the below code, what will be the output when you click on the button, after entering the text "message2" in the input box?

//HTML
<!DOCTYPE html>
<html>

  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.7/angular.min.js"></script>
    <script src="script.js"></script>
  </head>

  <body>
     <div ng-app="App">
        <div ng-controller="ChildCtrl">
          <input type="button" value="Get meesage" ng-click="method()">
          <div ng-include="'view.html'"></div>
        </div>
     </div>
  </body>

</html>


//Controller
var App = angular.module('App', []);

App.controller('ChildCtrl',['$scope','$window','$rootScope',function($scope,$window,$rootScope) {
  $scope.message = 'message';
  $scope.method = function(){
    $window.alert($scope.message);
  }
}]);

//view.html
<input type="text" ng-model="message" size="30" placeholder="message">

  1. message2
  2. message
  3. undefined
  4. messagemessage2
Tests in AngularJS for Juniors

Test Name Difficulty Time (minutes) No. of Questions
AngularJS Online Test for Juniors AngularJS Junior 40 20

More Specific Tests in AngularJS for Juniors

Test Name Difficulty Time (Minutes) No. of Questions
AngularJS-Basics Online Test for Juniors AngularJS - Basics Junior 20 10