Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Commit 80cae49

Browse files
authored
Merge pull request #1963 from mehanika/bugfix-map-control
Fixed error in map control
2 parents ff46609 + 4ba3866 commit 80cae49

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

spec/coffee/directives/api/control.spec.coffee

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ describe "directives.api.control", ->
99
expect(@subject).toBeDefined()
1010
@log.error.calls.reset()
1111

12-
it "should log error if no template is supplied", ->
13-
html = angular.element """
14-
<ui-gmap-google-map center="map.center" zoom="map.zoom">
15-
<ui-gmap-map-control></ui-gmap-map-control>
16-
</ui-gmap-google-map>
17-
"""
18-
element = @compile(html)(@scope)
19-
@rootScope.$apply()
20-
expect(@log.error).toHaveBeenCalledWith('mapControl: could not find a valid template property or elements for transclusion')
21-
@log.error.calls.reset()
22-
2312
it "should load template", ->
2413
html = angular.element """
2514
<ui-gmap-google-map center="map.center" zoom="map.zoom">

src/coffee/directives/api/control.coffee

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ angular.module("uiGmapgoogle-maps.directives.api")
99
GoogleMapApi.then (maps) =>
1010
# Validate attributes
1111

12-
transcludedContent = transclude()
13-
14-
hasTranscludedContent = transclude().length > 0
15-
16-
if !hasTranscludedContent && angular.isUndefined scope.template
17-
@$log.error 'mapControl: could not find a valid template property or elements for transclusion'
18-
return
12+
hasTranscludedContent = angular.isUndefined scope.template
1913

2014
index = if angular.isDefined scope.index and not isNaN(parseInt scope.index) then parseInt scope.index else undefined
2115

@@ -44,7 +38,7 @@ angular.module("uiGmapgoogle-maps.directives.api")
4438

4539
controlDiv.append transcludeEl
4640

47-
pushControl(map, controlDiv, index)
41+
pushControl(map, controlDiv.children(), index)
4842

4943
else
5044
$http.get(scope.template, { cache: $templateCache })

0 commit comments

Comments
 (0)