Skip to content

Instantly share code, notes, and snippets.

@khades
Created April 7, 2016 08:20
Show Gist options
  • Save khades/4462ab44838ace8eb5c77d9080308151 to your computer and use it in GitHub Desktop.
Save khades/4462ab44838ace8eb5c77d9080308151 to your computer and use it in GitHub Desktop.
var InputComponent = {
view: function(ctrl, args) {
return m(".pure-control-group", {
class: !!args.error && args.error() != null ? "has-error" : ""
},[
m("label", {
for: args.id
}, args.label),
m("input.pure-input-1", {
id: args.id,
type: "text",
oninput: m.withAttr("value", (!!args.oninput) ? args.oninput : args.value),
value: args.value()
}),
!!args.error && args.error() != null ? m("span.help-block",args.error()) : null
])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment