¿Cómo configurar el servicio para pasar ID de hoja de Google? AngularJS
Estoy construyendo un pequeño widget usando angular que toma los ID de hoja de Google proporcionados por el usuario y publica la salida en un buen formato json. El problema es que mi código no hace nada. No hay errores en la consola y cuando agrego ID no sucede nada
Supongo que el problema está enservice.js
angular.module('adf.widget.charts')
.service('chartService', function(){
return {
getUrl: function(key){
var googleSheetkey = key
}
}
return googleSheetkey
});
edit.html (para agregar ID de hoja)
<form role="form">
<div class="form-group">
<label for="sample">Sample</label>
<input type="text" class="form-control" id="sample" ng-model="config.googleSheetkey" placeholder="Enter path">
</div>
</form>
App.js
angular.module('adf.widget.charts', ['adf.provider', 'nvd3'])
.config(function(dashboardProvider){
var widget = {
templateUrl: '{widgetsPath}/charts/src/view.html',
reload: true,
resolve: {
/* @ngInject */
urls: function(chartService, config){
if (config.key){
return chartService.getUrl(config.googleSheetkey);
}
}
},
edit: {
templateUrl: '{widgetsPath}/charts/src/edit.html'
}
};
dashboardProvider
.widget('piechart', angular.extend({
title: 'Custom Piechart',
description: 'Creates custom Piechart with Google Sheets',
controller: 'piechartCtrl'
}, widget));
});
Controlador
angular.module('adf.widget.charts')
.controller('piechartCtrl', function (chartService, $scope) {
window.onload = function() { init() };
function init() {
Tabletop.init( { key: chartService.googleSheetkey,
callback: function(data, tabletop) { console.log(data) },
simpleSheet: true } )
}
});