How to call vis object in the controller?

(Yu Watanabe) #1

According to below site, variables set in the visualization are available as in template.

However, I want to use the vis.params in the controller instead of template.
When I do this, I get below errors when I try to call the vis object in the controller.

ReferenceError: vis is not defined
    at Object.fn (linechart-rj-cont.js:104)
    at Scope.$digest (angular.js:15826)
    at Scope.$apply (angular.js:16097)
    at HTMLTableCellElement.<anonymous> (angular.js:23554)
    at HTMLTableCellElement.dispatch (jquery.js:4435)
    at HTMLTableCellElement.elemData.handle (jquery.js:4121)

Below is the snippet of my code from controller.

// Build query for arm
$scope.robot_name = filters[0].query.match[$scope.tbl_key1].query;

$scope.data_type = vis.params.data_type;
$scope.parts_name = vis.params.thold_type;

Below is my template in visualiation.

<input type="radio" ng-model="vis.params.data_type" value="run">
<input type="radio" ng-model="vis.params.data_type" value="jump_r">

How can I call vis object in the controller? If I cant, how can I use the variables which is set in visualization in the controller?

(Yu Watanabe) #2

I solved this by myself.

Accessing vis.params.data_type in template means vis object is stored in $scope.
Which means , I could access in controller by $scope.vis.params.xx

(Spencer Alger) #3

Glad you figured it out!

(system) #4