javascript - Explain some knockout code -
<div data-bind="template: { name: 'editfile', 'if': filetoedit, data: filetoedit },mydialog: { open: filetoedit, accept: acceptfile, cancel: cancelfile, position: $root.lastclicked }"> </div> how 'filetoedit' invoked ? think 'mydialog' custom template ? looks invoked code :
ko.bindinghandlers.mydialog is iniitialising custom bindings 'mydialog' ?
knockout provides documentation of parameters :
name — id of element contains template wish render - see note 5 how vary programmatically. data — object supply data template render. if omit parameter, ko foreach parameter, or fall on using current model object. if — if parameter provided, template rendered if specified expression evaluates true (or true-ish value). can useful preventing null observable being bound against template before populated. foreach — instructs ko render template in “foreach” mode - see note 2 details. — when used in conjunction foreach, defines alias each item being rendered - see note 3 details.
you can @ knockout template documentation. understand template rendered if 'filetoedit' variable not null.
'mydialog' is custom binding handler. initialized div created.
Comments
Post a Comment