Simple angular todo list

by vathana shankar

HTML

<div ng-app="vath">
    
    <div ng-controller="taskController">
        
        <ul ng-repeat="t in tasks">
            <li>{{t}} - <button ng-click="remove(t)">Remove</button></li>
        </ul>
        
        <div>
            <input type="text" ng-model="newTask" /> <button ng-click="addTask()">Add Task</button>
        </div>
        <div>
            Preview: <span ng-bind="newTask"></span>
            {{message}}
            first name :{{person.firstName}}
        </div>
    </div>
    
</div>

JavaScript

var myModule = angular.module('vath', []);

myModule.controller('taskController', function($scope){

    // My controller
    $scope.tasks = ['Refactor Something'];
    $scope.newTask = '';
    $scope.addTask = function() {
        console.log($scope.newTask);
        $scope.tasks.push($scope.newTask);
        $scope.newTask = '';
    };
    $scope.remove = function(t){
        $scope.tasks.remove(t);
    };
    var person={firstName:"vathana",lastName:"shankar"};
  $scope.person=person; 
$scope.message="Hello, Angular";
});

Array.prototype.remove = function() {
    var what, a = arguments, L = a.length, ax;
    while (L && this.length) {
        what = a[--L];
        while ((ax = this.indexOf(what)) !== -1) {
            this.splice(ax, 1);
        }
    }
    return this;
};