Troubleshooting widgets
There are a few different methods of troubleshooting a widget, depending on the information you're looking for. In the server script, we can use gs.log()
or gs.info()
to log data from the server. In the client controller and the body HTML template, we can use console.log()
or console.warn()
, and use the browser's console to debug certain issues.
Note
Technically we can use alert()
, but generally, logging in the console is better.
The Widget Context Menu is also helpful for troubleshooting. In particular, the last two items can be incredibly helpful:
Let's briefly go over what they each do:
Log to console: $scope: This prints out the widget instance object, with all the parameters/values associated with that widget instance.
Log to console: $scope.data: This is generally used more often. Instead of printing the entire scope, it prints the data object contained in that scope. The data object is the predefined object we built in the server script of our widget. If a widget...