'use strict';

app.directive('favChannelsForm', function (){
  return {
    restrict: 'EA',
    require: 'ngModel',
    replace: true,
    scope: {
      device: '=ngModel',
      formName: '='
    },
    templateUrl: 'views/installer/new/devices/fav-channels.html',
    controller: function ($scope) {

      $scope.$watch('device.db.type', function(newValue, oldValue) {
        if (newValue !== 'Televisions' && newValue !== 'Satellite Set Top Boxes' && newValue !== 'Cable and Fios Set Top Boxes' && newValue !== 'DVR') {
          $scope.device.attr.fav = 0;
        }
      });
    }
  };
});
