May be is a stupid question... but I wanna make best practices. So.. I have my controller:
(function() {
'use strict';
angular
.module('example.cancha')
.controller('CanchaController', CanchaController);
CanchaController.$inject = ['$state', 'canchaService'];
function CanchaController($state, canchaService) {
var vm = angular.extend(this, {
canchasComplejo: []
});
(function activate() {
cargarCanchasComplejo();
})();
//funcion que llama al servicio para obtener las canchas del complejo
function cargarCanchasComplejo() {
canchaService.obtenerCanchasComplejo()
.then(function(canchasComplejo) {
vm.canchasComplejo = canchasComplejo;
});
}
}
})();
ng-click="toggleGroup(group)"
ng-class="{active: isGroupShown(group)}".
.controller('MyCtrl', function($scope) {
...
});
you can inject $scope in the same way you are inject $state so:
CanchaController.$inject = ['$state', '$scope', 'canchaService'];
function CanchaController($state, $scope, canchaService) { ...