Skip to content

Instantly share code, notes, and snippets.

@byronferguson
Last active September 21, 2015 20:00
Show Gist options
  • Save byronferguson/d6b5560b13ce976ae0ac to your computer and use it in GitHub Desktop.
Save byronferguson/d6b5560b13ce976ae0ac to your computer and use it in GitHub Desktop.
ui-route oddly misbehaving somewhere
'use strict';
/**
* @ngdoc overview
* @name app [smartadminApp]
* @description
* # app [smartadminApp]
*
* Main module of the application.
*/
angular.module('app', [
//'ngSanitize',
'ngAnimate',
'restangular',
'ui.router',
'ui.bootstrap',
// Smartadmin Angular Common Module
'SmartAdmin',
// App
'app.auth',
'app.layout',
'app.chat',
'app.dashboard',
'app.calendar',
'app.inbox',
'app.graphs',
'app.tables',
'app.forms',
'app.ui',
'app.widgets',
'app.maps',
'app.appViews',
'app.misc',
'app.smartAdmin',
'app.student-profiles'
])
.config(function ($provide, $httpProvider) {
// Intercept http calls.
$provide.factory('ErrorHttpInterceptor', function ($q) {
var errorCounter = 0;
function notifyError(rejection){
console.log(rejection);
$.bigBox({
title: rejection.status + ' ' + rejection.statusText,
content: rejection.data,
color: "#C46A69",
icon: "fa fa-warning shake animated",
number: ++errorCounter,
timeout: 6000
});
}
return {
// On request failure
requestError: function (rejection) {
// show notification
notifyError(rejection);
// Return the promise rejection.
return $q.reject(rejection);
},
// On response failure
responseError: function (rejection) {
// show notification
notifyError(rejection);
// Return the promise rejection.
return $q.reject(rejection);
}
};
});
// Add the interceptor to the $httpProvider.
$httpProvider.interceptors.push('ErrorHttpInterceptor');
})
.constant('APP_CONFIG', window.appConfig)
.run(function ($rootScope
, $state, $stateParams
) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
// editableOptions.theme = 'bs3';
})
.run(function($state) {
console.table($state.get());
})
.run(function($rootScope) {
$rootScope.$on('$stateChangeStart', function(evt, to, toParams) {
console.log('Start: ', to, toParams);
});
$rootScope.$on('$stateChangeSuccess', function(evt, to, toParams) {
console.log('Success: ', to, toParams);
});
$rootScope.$on('$stateChangeError', function(evt, to, toParams) {
console.log('Error: ', to, toParams);
});
});
Error: Could not resolve 'app.student.profiles' from state 'app'
at Object.y.transitionTo (vendor.js:492)
at Object.y.go (vendor.js:492)
at vendor.js:492
at vendor.js:272
at e (vendor.js:167)
at vendor.js:170vendor.js:232 (anonymous function)vendor.js:204 $getvendor.js:272 (anonymous function)vendor.js:167 evendor.js:170 (anonymous function)
'use strict';
angular.module('app.student-profiles', [ 'ui.router']);
angular.module('app.student-profiles').config(function ($stateProvider) {
alert('inside module config');
$stateProvider
.state('app.student', {
abstract: true,
data: {
title: 'Student'
}
})
.state('app.student.profiles', {
url: '/student/profiles',
data: {
title: 'Student Profiles'
},
views: {
"content@app": {
templateUrl: 'app/student-profiles/views/student-profiles.html',
controller: 'StudentProfilesCtrl as spc'
}
},
resolve: {
scripts: function(lazyScript){
return lazyScript.register([
'jqgrid',
'jqgrid-locale-en'
]);
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment