<div>
  <div class="form-group" ng-if="device.target.type === 1">
    <label>Base station infrared (IR) output setting:</label>

    <div class="radio">
      <label>
        <input type="radio" name="rear" ng-model="device.target.port"  ng-value="255"> Wired IR emitters attached to my device
      </label>
    </div>


    <div class="radio">
      <label>
        <input type="radio" name="front" ng-model="device.target.port"  ng-value="0"> Wireless IR (requires line of sight from the base station to the device)
      </label>
    </div>


    <div ng-if="room.bstations.length > 1">
      <p>There are multiple control extenders available in this room. Select which one will control this device.</p>
      <select name="baseStation" ng-model="device.target.addr" ng-options="idx as baseStation.name +' (' + baseStation.type + ')' for (idx, baseStation) in room.bstations" required>  </select>
    </div>
  </div>


  <div class="form-group" ng-if="device.target.type === 2">
    <div class="form-group">
      <label for="ipAddress">IP address</label>
      <input class="form-control" type="text" name="ipAddress" placeholder="Enter IP address" ng-model="device.target.addr" ng-pattern="/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/" required>
      <p class="help-block" ng-show="formName.ipAddress.$error.required && formName.ipAddress.$dirty">An IP address is required.</p>
      <p class="help-block" ng-show="formName.ipAddress.$error.pattern && formName.ipAddress.$dirty">Please enter a valid IP address.</p>
    </div>

    <div class="form-group">
      <label for="port">Port</label>
      <input class="form-control" type="number" name="port" placeholder="Enter port number" ng-model="device.target.port" min="0" max="65535" ng-maxlength="5" required>
      <p class="help-block" ng-show="formName.port.$error.required && formName.port.$dirty">A port number is required.</p>
      <p class="help-block" ng-show="formName.port.$error.min || formName.port.$error.max && formName.port.$dirty">Please enter a number between 0 and 65535.</p>
    </div>
  </div>
</div>