Adding states from a json


Hi there,
I’m trying to get the states for my stateProvider from a json file. I found something similar for Angular-Apps at stackoverflow (
So i tried to adapt this to my ionic app. but somehow the states can not be reached.

var $stateProviderReference;
var $routerProviderReference;
var database = null;
var universaldiag2 = angular.module('starter', ['ionic', 'ngCordova'])

universaldiag2.config(['$stateProvider', '$urlRouterProvider',function($stateProvider, $urlRouterProvider) {
}]);$ionicPlatform, $cordovaSQLite, $http, $state) {

        console.log("routes.json has been found");
        angular.forEach(data, function(route){
           console.log(" "+route.url+" "+route.template);
            $stateProviderReference.state(, {url: route.url, template: route.template});
    $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) {
    //open database and create tables if they don't exist
    database= $cordovaSQLite.openDB({ name: "diag.db"});
    $cordovaSQLite.execute(database,"CREATE TABLE IF NOT EXISTS device (deviceId integer primary key, name text, manufacturer text, yob integer, serial text)");
    console.log("database succesfully created");

The json-file looks like

    "url": "/chooseDiag",
    "template": "comp/chooseDiag.html"

The errormessage reads as following:

 Error: Cannot transition to abstract state '[object Object]' 

Has anyone an idea why this does not work?

cheers martin