pub fn bind_checked(&self, sub: Signal<bool>) -> &Self {
        let sub_handle = create_memo(cloned!((sub) => move || {
            Some(*sub.get())
        }));

        self.dyn_prop("checked", sub_handle);

        self.on("change", move |e| {
            let value = Reflect::get(
                &e.target().expect("Target missing on change event."),
                &"checked".into(),
            )
            .expect("Failed to get checked prop.")
            .as_bool();

            if let Some(value) = value {
                sub.set(value);
            } else {
                panic!(
                    "Checked is only available on input elements with type attribute set to checkbox."
                );
            }
        })
    }
/// Binds `sub` to the `checked` property of the node.
///
/// `sub` will be automatically updated when the value is updated.
///
/// # Example
/// ```
/// # use sycamore::prelude::*;
/// # use sycamore::builder::html::*;
/// # fn _test<G: Html>() -> View<G> {
/// let checked = Signal::new(false);
///
/// input()
///     .attr("type", "checkbox")
///     .bind_checked(checked)
///     .build()
/// # }
/// ```
Binds `sub` to the `checked` property of the node.
`sub` will be automatically updated when the value is updated.
Binds ` sub ` to the ` checked ` property of the node . ` sub ` will be automatically updated when the value is updated .
pub fn bind_checked(&self, sub: Signal<bool>) -> &Self {
        let sub_handle = create_memo(cloned!((sub) => move || {
            Some(*sub.get())
        }));
        self.dyn_prop("checked", sub_handle);
        self.on("change", move |e| {
            let value = Reflect::get(
                &e.target().expect("Target missing on change event."),
                &"checked".into(),
            )
            .expect("Failed to get checked prop.")
            .as_bool();
            if let Some(value) = value {
                sub.set(value);
            } else {
                panic!(
                    "Checked is only available on input elements with type attribute set to checkbox."
                );
            }
        })
    }
pub fn bind_checked ( & self , sub : Signal < bool > ) -> & Self { let sub_handle = create_memo ( cloned ! ( ( sub ) move { Some ( sub get ( ) ) } ) ) ; self . dyn_prop ( " " , sub_handle ) ; self . on ( " " , move | e | { let value = Reflect :: get ( & e . target ( ) . expect ( " " ) , & " " . into ( ) , ) . expect ( " " ) . as_bool ( ) ; if let Some ( value ) = value { sub . set ( value ) ; } else { panic ! ( " " ) ; } } ) }
Binds `sub` to the `checked` property of the node.
Binds ` sub ` to the ` checked ` property of the node .
&self
sub
Signal<bool>
example
None
use sycamore::prelude::*;
None
use sycamore::builder::html::*;
None
fn _test<g: html>() -> view<g> {
let checked = Signal::new(false).

input()
.attr("type", "checkbox")
.bind_checked(checked)
.build()
let checked = Signal :: new ( false ) . input () . attr ( " type " " checkbox " ) . bind_checked ( checked ) . build ()
}
None