I’m trying to get my custom javascript to be able to read config values from the settings of a widget. I have the $scope within my controller, but when I print it out to the console I can’t see anything that looks like its config. Here’s the relevant code:
(function(){
'use strict';
angular
.module('RgbLedModule',[])
.controller('MyController',RgbController);
RgbController.$inject = ['$scope','OHService'];
function RgbController($scope,OHService){
$scope.setTwoColourValues = function(){
console.log('still angular ftw');
console.dir($scope);
... more code removed
};
};
})();
The scope has a bunch of stuff on it, but no config that I can see. it doesn’t look like it is even strictly necessary to inject the scope explicitly as this also works identically:
(function(){
'use strict';
angular
.module('RgbLedModule',[])
.controller('MyController', function($scope,OHService){
$scope.setTwoColourValues = function(){
console.log('still angular ftw');
console.dir($scope);
... more code removed
};
};
})();
Within the settings tab of the widget designer I have two defined: “location” and “item_id”, both with type String. This link suggests that once I have $scope I can access the settings using $scope.config.<setting_name> but $scope.config is undefined. So how do I access them from my controller?