I can not understand and fix this error. I'm using ionic.
Uncaught Error: [$ injector: modulerr] Failed to instantiate module inparty due to: Error: [$ injector: modulerr] Failed to instantiate module inparty.controllers due to: Error: [$ injector: nomod] Module 'inparty.controllers' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
angular.module('inparty.controllers', [])
.controller('AppCtrl', function($scope, $ionicModal, $timeout) {
// Form data for the login modal
$scope.loginData = {};
// Create the login modal that we will use later
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
// Triggered in the login modal to close it
$scope.closeLogin = function() {
$scope.modal.hide();
};
// Open the login modal
$scope.login = function() {
$scope.modal.show();
};
// Perform the login action when the user submits the login form
$scope.doLogin = function() {
console.log('Doing login', $scope.loginData);
// Simulate a login delay. Remove this and replace with your login
// code if using a login system
$timeout(function() {
$scope.closeLogin();
}, 1000);
};
})
.controller('PlaylistsCtrl', function($scope,$http) {
$scope.dados = Array();
$http.get("js/dados.php").success(function(data){
$scope.dados = data.dados;
console.log($scope.dados);
}).error(function(data){
alert("Error...");
console.log(data);
});
})
.controller('PlaylistCtrl', function($scope, $stateParams) {
var idParaEncontrar = $stateParams.id;
console.log(idParaEncontrar);
var objectoEncontrado = undefined;
for(var i = 0; i < $scope.dados.length: ++i){
if($scope.dados[i].id === idParaEncontrar) {
objectoEncontrado = $scope.dados[id];
break;
}
}
if(objectoEncontrado !== undefined) {
console.log("objecto encontrado")
}
});
app.js
angular.module('inparty', ['ionic', 'inparty.controllers','ngRoute'])
.run(function($ionicPlatform) {
$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) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('app', {
url: "/app",
abstract: true,
templateUrl: "templates/menu.html",
controller: 'AppCtrl'
})
.state('app.search', {
url: "/search",
views: {
'menuContent': {
templateUrl: "templates/search.html"
}
}
})
.state('app.browse', {
url: "/browse",
views: {
'menuContent': {
templateUrl: "templates/browse.html"
}
}
})
.state('app.playlists', {
url: "/playlists",
views: {
'menuContent': {
templateUrl: "templates/playlists.html",
controller: 'PlaylistsCtrl'
}
}
})
.state('app.single', {
url: "/playlists/:id",
views: {
'menuContent': {
templateUrl: "templates/playlist.html",
controller: 'PlaylistCtrl'
}
}
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/playlists');
});