fix(templateCache): make sure $state is passed config options before checking what they are

This commit is contained in:
Perry Govier
2014-09-11 15:25:49 -05:00
parent f5e986c922
commit cb9b81d57e

View File

@@ -101,7 +101,7 @@ function($stateProvider, $ionicConfigProvider) {
var stateProviderState = $stateProvider.state;
$stateProvider.state = function(stateName, definition) {
// don't even bother if it's disabled. note, another config may run after this, so it's not a catch-all
if($ionicConfigProvider.prefetchTemplates() !== false){
if(typeof definition === 'object' && $ionicConfigProvider.prefetchTemplates() !== false){
var enabled = definition.prefetchTemplate !== false;
if(enabled && isString(definition.templateUrl))templatesToCache.push(definition.templateUrl);
if(angular.isObject(definition.views)){