Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

placeholder's dont work (need to use variable to bind) #181

Closed
stringbeans opened this issue Mar 18, 2016 · 5 comments
Closed

placeholder's dont work (need to use variable to bind) #181

stringbeans opened this issue Mar 18, 2016 · 5 comments

Comments

@stringbeans
Copy link

Using angular 1.5.1 and latest version of angular-chosen

tried defining the chosen select as so:

select.form-control(
    name='school'
    chosen
    ng-model='pageData.selectedSchool'
    ng-options='school.name for school in pageData.schools'
    ng-if='!isDisabled'
    required
    ng-change='pageData.selectSchool($item)'
    data-placeholder="Pick one of these"
  )

And the placeholder is not set to "Pick one of these". I've also tried using placeholder-text-single and placeholder attributes and they also do not work (placeholder-text-single actually gives an error).

@leocaseiro
Copy link
Owner

Hi @stringbeans, thank you for your request.

The correct placeholders for Chosen and Angular Chosen are:
placeholder-text-multiple and placeholder-text-single

Check our Documentation and an Example

@leocaseiro
Copy link
Owner

Sorry I've just read your last expression:

And the placeholder is not set to "Pick one of these". I've also tried using placeholder-text-single and placeholder attributes and they also do not work (placeholder-text-single actually gives an error).

Could you please be more specific about your error?

That would be nice if you could fork my plunkr and make your changes.

@leocaseiro
Copy link
Owner

My plunkr up to date with Angular Chosen 1.3.0 and Angular 1.5.1: http://plnkr.co/edit/PWvVlB?p=preview

Tested up to multiple and single following your settings

@stringbeans
Copy link
Author

@leocaseiro thanks for the speedy response! i looked at your plunkr and noticed that i'm setting the attribute wrong. instead of placeholder-text-single='hello there' it should be placeholder-text-single="'hello there'"

this was not reflected in the documentation and is possibly why i was confused. if you're up for it i can do a pull request on your docs to update this.

btw, we are also a techstars company, so hi!

@leocaseiro
Copy link
Owner

Yeah! This because those string attributes emulating a scope type '@'
With that said, you could have a variable to bind on your placeholder:

$scope.customPlaceholder: 'My message';
<select chosen placeholder-text-single="customPlaceholder">...</select>

PR are always welcome. We use slate on docs branch.

Send me a PR there. That would be nice refer the egghead link.

@leocaseiro leocaseiro changed the title placeholder's dont work placeholder's dont work (need to use variable to bind) Mar 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants