<div>
  This is air time tracker
  <table class="table table-stripped">
    <thead>
      <tr>
        <th class="col-md-2">Время</th>
        <th class="col-md-10">Описание</th>
      </tr>
    </thead>
    <tbody class="row">
      <tr ng-repeat="timestamp in timestamps">
        <td class="col-md-2">{{timestamp.time}}</td>
        <td class="col-md-10">
          <input ng-if="timestamp.edit" type="text" name="" ng-model="timestamp.label">
          <span ng-if="!timestamp.edit">{{timestamp.label}}</span>
          <span class="glyphicon glyphicon-pencil" ng-if="!timestamp.edit" ng-click="timestamp.edit = true"></span>
          <span class="glyphicon glyphicon-ok" ng-if="timestamp.edit" ng-click="saveLabel($index, timestamp)"></span>
        </td>
      </tr>
    </tbody>
  </table>
  <div>
    <button class="btn btn-default" ng-click="trackTime()">Track</button>
  </div>
</div>


// Code goes here

var app = angular.module('radioStation', []);

var TIMESTAMPS = [
  {
    "time": "00:00:00",
    "label": "Новости",
    "edit": false
  }
];


app.directive('airtimetracker', function(){
  return {
    restrict: 'E',
    replace: true,
    templateUrl: 'timetracker.html',
    scope: {},
    controller: ['$scope', function($scope){
      $scope.timestamps = TIMESTAMPS;

      $scope.saveLabel = function(index, timestamp) {
        $scope.timestamps[index].edit = false;
        console.log("Timestamp saved");
      }
      $scope.trackTime = function(e) {
        var now = new Date().toString();
        $scope.timestamps.push({"time": now, "label": "", edit: true});
      }
    }]
  }
})

Изменить пасту