mdPickers icon indicating copy to clipboard operation
mdPickers copied to clipboard

bind mdpPlaceholder as '@'

Open leocaseiro opened this issue 9 years ago • 5 comments

Hi, I'd like to let my placeholder dynamic, so I can define it on my controller, like so:

$scope.customPlaceholder = 'My Date';
<mdp-date-picker 
        mdp-placeholder="{{customPlaceholder}}">

Is there a way to bind it?

As it's not a $scope, but an attribute only, I believe attributes.$observe will help to make it happen.

Cheers

leocaseiro avatar Apr 28 '16 01:04 leocaseiro

I've edited the template

from:

'<input type="{{ ::type }}" aria-label="' + placeholder + '" placeholder="' + placeholder + '"' + (openOnClick ? ' ng-click="showPicker($event)" ' : '') + ' />' +

to

'<input type="{{ ::type }}" aria-label="{{placeholder}}" placeholder="{{placeholder}}"' + (openOnClick ? ' ng-click="showPicker($event)" ' : '') + ' />' +

It works just fine, but I found a bug on Angular Material while try to bind placeholder. It gets duplicate if you don't set md-no-float

material-placeholder-duplicated

I openned this issue https://github.com/angular/material/issues/8251

leocaseiro avatar Apr 28 '16 02:04 leocaseiro

Seems that the problem with duplicate placeholder from Angular Material has been solved at 1.1.0-rc.5 version. I tested here and works fine. If you want I could provide a pull request changing the mdpDatePicker and updating angular material dependency at bower.json

marcomafessolli avatar Jun 21 '16 17:06 marcomafessolli

Hi @marcomafessolli, thanks for that.

That would be awesome.

leocaseiro avatar Jun 22 '16 01:06 leocaseiro

@leocaseiro I've created a pull request. Check it out: #127

Maybe this isn't going to be merged because it depends of a release candidate version of Angular Material. So, until then, you can download via bower from my forked repo using bower install marcomafessolli/mdPickers

marcomafessolli avatar Jun 22 '16 11:06 marcomafessolli

Thanks for that @marcomafessolli. I think that should be merged with the next Material release. But yeah, I can definitely use for the time being.

leocaseiro avatar Jun 22 '16 23:06 leocaseiro