Sha256: 12e07d129a88ed705202c3ff1e2c169bf13d9aac0e276ba293a67299d73a1a30

Contents?: true

Size: 855 Bytes

Versions: 2

Compression:

Stored size: 855 Bytes

Contents

var RobotCtrl = function RobotCtrl($scope, $http, $routeParams) {
  $http.get("/robots/" + $routeParams.robot).success(function(data) {
    $scope.robot = data;

    $scope.robot.params = [ { name: '', value: '', type: 'string' } ];
    $scope.robot.results = [];
  });

  $scope.select = function(device) {
    $scope.device = ($scope.device === device) ? null : device;

    // setting up params we'll need in other controllers
    if ($scope.device.params == null) {
      $scope.device.params = [ { name: '', value: '', type: 'string' } ];
    }

    if ($scope.device.events == null) { $scope.device.events = []; }
    if ($scope.device.results == null) { $scope.device.results = []; }
    if ($scope.device.listeners == null) { $scope.device.listeners = {}; }
  }

  $scope.selected = function(device) {
    return ($scope.device === device);
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
robeaux-0.1.1 js/controllers/robot_ctrl.js
robeaux-0.1.0 js/controllers/robot_ctrl.js