Tabs don't load controller


Hi guys, I have a problem with my app.

I’m using a sqlite plugin to load a database fields, but in my home tab don’t charge the db. I need to move the controller to another tab for i can see the info.

This is my code:

var ionicApp = angular.module(‘starter’, [‘ionic’, ‘ngCordova’])

.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
if(window.StatusBar) {

**window.plugins.sqlDB.copy("vehiculos.db", function() {**
  **db = $cordovaSQLite.openDB("vehiculos.db");**
**}, function(error) {**
  **console.error("There was an error copying the database: " + error);**
  **db = $cordovaSQLite.openDB("vehiculos.db");**

.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {

// Ionic uses AngularUI Router which uses the concept of states
// Learn more here:
// Set up the various states which the app can be in.
// Each state’s controller can be found in controllers.js
$ionicConfigProvider.tabs.position(“bottom”); //Places them at the bottom for all OS
$“standard”); //Makes them all look the same across all OS


// setup an abstract state for the cruzs directive
.state(‘crz’, {
url: “/crz”,
abstract: true,
templateUrl: “templates/menu.html”

// Each cruz has its own nav history stack:

.state(‘crz.inicio’, {
url: ‘/inicio’,
views: {
‘crz-inicio’: {
templateUrl: ‘templates/crz-inicio.html’,

.state(‘cruz.favoritos’, {
url: ‘/favoritos’,
views: {
‘cruz-favoritos’: {
templateUrl: ‘templates/cruz-favoritos.html’,
controller: ‘MarcasController’
// if none of the above states are matched, use this as the fallback


ionicApp.controller(“MarcasController”, function($scope, $ionicPlatform, $ionicLoading, $cordovaSQLite) {

**$scope.marcas = [];**

**$ionicPlatform.ready(function() {**
    **var query = "SELECT DISTINCT(IdMarcaVeh), MarcaVeh FROM cr_tbvehiculos AS tbv LEFT JOIN cr_vehiculos_mercados as vm ON tbv.IdVeh=vm.IdVeh LEFT JOIN cr_mercados as m  ON vm.CodMercado=m.Mercado WHERE Lang='es' ORDER BY MarcaVeh";**
    **$cordovaSQLite.execute(db, query, []).then(function(res) {**

        **if(res.rows.length > 0) {**
            **for(var i = 0; i < res.rows.length; i++) {**
                **$scope.marcas.push({marca: res.rows.item(i).MarcaVeh, IdMarcaVeh: res.rows.item(i).IdMarcaVeh});**
    **}, function (err) {**