How do you inject a service (ie $log) into a controller within the AngularJS visual builder? -Bootstrap/AngularJS
eg. I would like to use the built-in $log service within one of my controllers. I do not see a way I can inject this service from within the init() function of the visual builder.
I can go into the source files - WEB_RESOURCES - app - pages - my_page_nameController.js file and add it to the APP.controller call.
e.g. codeAPP.controller('my_page_name', ['$scope', 'ApperyioHelper', controller]); /code and insert '$log', between the '$scope', and 'ApperyioHelper', tags and then again in the codefunction controller($scope, Apperyio) { /code area between $scope, Apperyio and then use the $log function and it works within the init() function.
However, doing this breaks the link between the visual builder and the source file for the controller, forcing me to work only in code from then on with this controller.
I have tried using the "invoke service" button inside the init() function and then calling codeApperyio.get("$log");/code which doesn't error out. However, trying to use code$log.warn();/code afterwards does not work as $log is still undefined.
It is possible to use $log in a custom service by adding it to the codedeps: [ 'ApperyioHelper', '$log', func ]/code in the return statement. I just don't see how to inject this into the controller itself without screwing up the beautiful visual builder.