<!DOCTYPE html>
<html>

  <head>
     <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.2/angular.min.js"></script>
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
  </head>


    <body ng-app="app">
  
    <form ng-controller="TestController as testCtrl" ng-submit="testCtrl.addText(testCtrl.myText)">
        <input type="text" ng-model="testCtrl.myText" value="Lets go">
        <button type="submit">Add</button>
        <div ng-repeat="item in testCtrl.arrayText">
          <span>{{item}}</span>
        </div>
    </form>
 
  </body>

</html>
// Code goes here

(function(angular) {
  'use strict';
  var app = angular.module('app', []);

  app.controller('TestController', function($scope) {
    this.arrayText = [{
      text: 'Hello',
    }, {
      text: 'world'
    }, ]

    this.addText = function(text) {
      if (text) {
        var obj = {
          text: text
        };
        this.arrayText.push(obj);
        this.myText = '';
      }
    }

  });
})(window.angular);
/* Styles go here */