Sha256: 0da9a99bf1e71d808c41778c78d492b6e9c11d1fee72bbdc8b7fbe8f6357509c

Contents?: true

Size: 865 Bytes

Versions: 2

Compression:

Stored size: 865 Bytes

Contents

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

    $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.3.0 js/controllers/robot_ctrl.js
robeaux-0.2.0 js/controllers/robot_ctrl.js