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

(slideend) is not working as expected with [(ngModel)] [material version is alpha 10] #1802

Closed
amanullahnxb opened this issue Nov 10, 2016 · 5 comments · Fixed by #1901
Closed
Assignees

Comments

@amanullahnxb
Copy link

amanullahnxb commented Nov 10, 2016

i did two way binding md-slider with class attribute 'sliderVal'. as below code.

<md-slider (slideend)="onSlideEnd();" [min]="0" [max]="100" [(ngModel)]="sliderVal">

//class members

sliderVal: number = 10;

onSlideEnd(){
console.log("slider value", this.sliderVal);
}

but the problem is when onSlideEnd() is called. its shows previous slider value in console.

@amanullahnxb amanullahnxb changed the title (slideend) is not working as expected with [(ngModel)] (slideend) is not working as expected with [(ngModel)] [material version is alpha 10] Nov 10, 2016
@jelbourn
Copy link
Member

The slideend event isn't really meant to be used on the slider element. If you're just looking to know when the value changes, the slider now has a change event. Is that what you need?

@amanullahnxb
Copy link
Author

yes.. i have used (change) event too. but i am facing same problem

@amanullahnxb
Copy link
Author

amanullahnxb commented Nov 11, 2016

Here is my updated code.
<md-slider (change)="onSlideEnd($event);" [min]="0" [max]="100" [(ngModel)]="sliderVal"></md-slider>
//class members
sliderVal: number = 10;

onSlideEnd($event){
console.log("slider value", this.sliderVal);
}

again.. the value for sliderVal shows previous value. (not the current value of slider)

@josephperrott
Copy link
Member

Are you importing the FormsModule?

I was able to get this working with (slideend)

You can see a working plnkr here

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants