Skip to content

Commit

Permalink
Fixed error "ymaps is undefined", when use directive "yaTemplateLayou…
Browse files Browse the repository at this point in the history
…t" before map init.
  • Loading branch information
tulov committed Jun 10, 2014
1 parent 34baa5a commit 3e17369
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 5 additions & 2 deletions example/2.0/ya-map-2.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ angular.module('yaMap',[]).
});
};
}).
service('templateLayoutFactory',[function(){
service('templateLayoutFactory',['mapApiLoad',function(mapApiLoad){
this._cache = {};
this.get=function(key){
return this._cache[key];
Expand All @@ -134,7 +134,10 @@ angular.module('yaMap',[]).
if(this._cache[key]){
return;
}
this._cache[key] = ymaps.templateLayoutFactory.createClass(template,overadice);
var self=this;
mapApiLoad(function(){
self._cache[key] = ymaps.templateLayoutFactory.createClass(template,overadice);
});
};
}]).

Expand Down
7 changes: 5 additions & 2 deletions example/2.1/ya-map-2.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ angular.module('yaMap',[]).
});
};
}).
service('templateLayoutFactory',[function(){
service('templateLayoutFactory',['mapApiLoad',function(mapApiLoad){
this._cache = {};
this.get=function(key){
return this._cache[key];
Expand All @@ -148,7 +148,10 @@ angular.module('yaMap',[]).
if(this._cache[key]){
return;
}
this._cache[key] = ymaps.templateLayoutFactory.createClass(template,overadice);
var self=this;
mapApiLoad(function(){
self._cache[key] = ymaps.templateLayoutFactory.createClass(template,overadice);
});
};
}]).

Expand Down
Loading

0 comments on commit 3e17369

Please sign in to comment.