-
Notifications
You must be signed in to change notification settings - Fork 139
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
onOpen and onClose Params #354
Comments
Hello, I have the same question about the datepiker(date & time), how to call a function when the modal datepicker is closed. Thank you |
@KyDenZ here's an example of datepicker binding to onClose: @Component({
selector: "datePicker",
template: `
<input materialize="pickadate"
[materializeParams]="[{format: 'dd/mm/yyyy', onClose: doSomething }]"
type="text" />
`
})
export class DatePicker {
doSomething() {
console.log("here!");
}
} @maurocappe looking at youre code I see that the onOpen/onClose just calls the function when it's initialized. Remove the braces to make it a reference to a function and it should work (make it |
Perfect thank you ! |
oh... well.. rookie mistake. |
Thanks for the example @rubyboy but in your example |
Found a solution, in the component:
and then in the template it's as simple as using |
I am having trouble with the onOpen and onClose options materialize css provides. Are they not supported by angular2-materialize? i am trying to use them to make the sidenav push the content of the page instead of overlaying on top.
Here's the code:
openNav() { document.getElementById('body').style.marginLeft = '300px'; document.getElementById('sideNav').style.width = '300px'; document.getElementById('sideNav').style.visibility = 'active'; document.body.style.backgroundColor = 'rgba(0,0,0,0.4)'; document.body.style.backgroundColor = '#176EB1'; }
closeNav() { document.getElementById('body').style.marginLeft = '0px'; }
<a href="#" data-activates="sideNav" materialize="sideNav" [materializeParams]="[{onOpen: openNav(), onClose: closeNav()}]" class="nav-link button-collapse left"><i class="material-icons">menu</i></a></li>
The text was updated successfully, but these errors were encountered: