Skip to content

Commit c0c4811

Browse files
committed
$compile template on search directive to allow expressions in the placeholder value of the input field
1 parent 2fc71ce commit c0c4811

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

dist/angular-google-maps.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 2.1.0-SNAPSHOT 2014-11-11
1+
/*! angular-google-maps 2.1.0-SNAPSHOT 2014-11-12
22
* AngularJS directives for Google Maps
33
* git: https://github.com/angular-ui/angular-google-maps.git
44
*/
@@ -6755,7 +6755,7 @@ This directive creates a new scope.
67556755
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
67566756

67576757
angular.module("google-maps".ns()).directive("SearchBox".ns(), [
6758-
"GoogleMapApi".ns(), "Logger".ns(), "SearchBoxParentModel".ns(), '$http', '$templateCache', function(GoogleMapApi, Logger, SearchBoxParentModel, $http, $templateCache) {
6758+
"GoogleMapApi".ns(), "Logger".ns(), "SearchBoxParentModel".ns(), '$http', '$templateCache', '$compile', function(GoogleMapApi, Logger, SearchBoxParentModel, $http, $templateCache, $compile) {
67596759
var SearchBox;
67606760
SearchBox = (function() {
67616761
function SearchBox() {
@@ -6789,7 +6789,7 @@ This directive creates a new scope.
67896789
_this.$log.error('searchBox: invalid position property');
67906790
return;
67916791
}
6792-
return new SearchBoxParentModel(scope, element, attrs, map, ctrlPosition, template);
6792+
return new SearchBoxParentModel(scope, element, attrs, map, ctrlPosition, $compile(template)(scope));
67936793
});
67946794
});
67956795
};
@@ -6820,7 +6820,7 @@ angular.module('google-maps.wrapped'.ns()).service('GoogleMapsUtilV3'.ns(), func
68206820
return {
68216821
init: _.once(function () {
68226822
//BEGIN REPLACE
6823-
/*! angular-google-maps 2.1.0-SNAPSHOT 2014-11-11
6823+
/*! angular-google-maps 2.1.0-SNAPSHOT 2014-11-12
68246824
* AngularJS directives for Google Maps
68256825
* git: https://github.com/angular-ui/angular-google-maps.git
68266826
*/

dist/angular-google-maps.min.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

example/assets/scripts/controllers/search-box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ angular.module("search-box-example", ["google-maps".ns()])
99
}])
1010

1111
.run(['$templateCache', function ($templateCache) {
12-
$templateCache.put('searchbox.tpl.html', '<input id="pac-input" class="pac-controls" type="text" placeholder="Search Box">');
12+
$templateCache.put('searchbox.tpl.html', '<input id="pac-input" class="pac-controls" type="text" placeholder="{{3+5}}">');
1313
$templateCache.put('window.tpl.html', '<div ng-controller="WindowCtrl" ng-init="showPlaceDetails(parameter)">{{place.name}}</div>');
1414
}])
1515

src/coffee/directives/search-box.coffee

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ This directive creates a new scope.
1515
{attribute options optional} The options that can be set on a SearchBox object (google.maps.places.SearchBoxOptions object specification)
1616
###
1717
angular.module("google-maps".ns())
18-
.directive "SearchBox".ns(), ["GoogleMapApi".ns(), "Logger".ns(), "SearchBoxParentModel".ns(), '$http', '$templateCache',
19-
(GoogleMapApi, Logger, SearchBoxParentModel, $http, $templateCache) ->
18+
.directive "SearchBox".ns(), ["GoogleMapApi".ns(), "Logger".ns(), "SearchBoxParentModel".ns(), '$http', '$templateCache', '$compile',
19+
(GoogleMapApi, Logger, SearchBoxParentModel, $http, $templateCache, $compile) ->
2020
class SearchBox
2121
constructor: ->
2222
@$log = Logger
@@ -34,6 +34,7 @@ angular.module("google-maps".ns())
3434
parentdiv: '=parentdiv'
3535

3636
link: (scope, element, attrs, mapCtrl) =>
37+
3738
GoogleMapApi.then (maps) =>
3839
$http.get(scope.template, { cache: $templateCache })
3940
.success (template) =>
@@ -42,6 +43,6 @@ angular.module("google-maps".ns())
4243
if not maps.ControlPosition[ctrlPosition]
4344
@$log.error 'searchBox: invalid position property'
4445
return
45-
new SearchBoxParentModel(scope, element, attrs, map, ctrlPosition, template)
46+
new SearchBoxParentModel(scope, element, attrs, map, ctrlPosition, $compile(template)(scope))
4647
new SearchBox()
4748
]

0 commit comments

Comments
 (0)