'use strict';

app.directive('addRoomsDetail', function (){
  return {
    restrict: 'EA',
    replace: true,
    scope: {
      room: '=',
      rooms: '=',
      availableModels: '='
    },
    templateUrl: 'views/installer/new/rooms/rooms.detail.html',
    controller: function ($scope, Rooms) {
      //$scope.room = room;
      console.log($scope.room);      $scope.createNewBstation = function() {
        return Rooms.generateBstation();
      };

      $scope.$watch('room', function(newValue, oldValue) {
        if (!newValue && $scope.rooms.indexOf(newValue) > -1) {
          $scope.room = newValue;
        }
      });
    }
  };
});
