Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(select): support custom interpolate symbols
Browse files Browse the repository at this point in the history
closes #1590
  • Loading branch information
rschmukler committed Feb 24, 2015
1 parent 9497f06 commit 20b6611
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/select/select.js
Expand Up @@ -65,7 +65,10 @@ angular.module('material.components.select', [
* </md-select>
* </hljs>
*/
function SelectDirective($mdSelect, $mdUtil, $mdTheming) {
function SelectDirective($mdSelect, $mdUtil, $mdTheming, $interpolate) {
var intStart = $interpolate.startSymbol();
var intEnd = $interpolate.endSymbol();

return {
restrict: 'E',
require: '?ngModel',
Expand All @@ -78,11 +81,11 @@ function SelectDirective($mdSelect, $mdUtil, $mdTheming) {

// If not provided, we automatically make one
if (!labelEl.length) {
labelEl = angular.element('<md-select-label>').html('<span>{{' + attr.ngModel + ' !== undefined ? ' + attr.ngModel + ': \'' + attr.placeholder + '\'}}</span>');
labelEl = angular.element('<md-select-label>').html('<span>' + intStart + attr.ngModel + ' !== undefined ? ' + attr.ngModel + ': \'' + attr.placeholder + '\''+ intEnd + '</span>');
}
labelEl.append('<span class="md-select-icon" aria-hidden="true"></span>');
labelEl.addClass('md-select-label');
labelEl.addClass('{{ ' + attr.ngModel + ' ? \'\' : \'md-placeholder\'}}');
labelEl.addClass(intStart + attr.ngModel + ' ? \'\' : \'md-placeholder\'' + intEnd);
labelEl.attr('id', 'select_label_' + $mdUtil.nextUid());

// There's got to be an md-content inside. If there's not one, let's add it.
Expand Down

0 comments on commit 20b6611

Please sign in to comment.