Comments (11)
I don't like tricks like this.
I would suggest you not to use custom tags like that. You should create simple custom functions instead.
from binding.scala.
Ok, but how do i get Binding.Scala to emit <ons-page><ons-toolbar></ons-toolbar></ons-page>
even with a "simple custom function" ?
from binding.scala.
Something like onsPage(onsToolbar())
from binding.scala.
Yes, but how to i implement onsPage? It somehow has to produce Binding.Scala compatible tags of the kind <ons-page>
on the browser.
Obviously
@dom onsPage() = { <ons-page></ons-page> }
does not work.
from binding.scala.
Let your onsPage
function return a org.scalajs.dom.raw.Node
or Binding[org.scalajs.dom.raw.Node]
from binding.scala.
@sb-minimal
It seems <ons-page>${innerHTML}</ons-page>
is not supported.
But <ons-page></ons-page>
is supported.
see my https://github.com/sadhen/Binding-SemanticUI for example
from binding.scala.
@sadhen , I guess @sb-minimal means custom HTML tags, which is not what you are talking about.
from binding.scala.
guess I am getting something completely wrong.
I tried:
def onsPage(content: BindingSeq[Node]) = {
val element=document.createElement("ons-page")
content.map{ c =>
element.appendChild(c)
}
element
}
def onsToolbar(content: Node) = {
document.createElement("ons-toolbar")
}
val pageTitle: Var[String]=Var("Titel")
@dom
def app = {
<div> {
onsPage(Seq(
onsToolbar(
<div class="left">back</div>
<div class="center">{ pageTitle.get } </div>
),
<p>
content
</p>
))
}
</div>
}
getting
type mismatch;
[error] found : com.thoughtworks.binding.Binding.BindingSeq[org.scalajs.dom.raw.Node]
[error] required: org.scalajs.dom.raw.Node
[error] @dom
[error] ^
[error] one error found
Is document.createElement("ons-page")
even the correct way to produce the org.scalajs.dom.raw.Node
?
Would be very helpful if you could point me to some example code or could give a simple implementation for onsPage()
.
from binding.scala.
You can use NodeSeqMountPoint at the moment. See https://scalafiddle.io/sf/gII6UlB/0
from binding.scala.
However, I guess it would be good if we have a special syntax to disable tag name checking, like the data:
prefix for attributes. https://github.com/ThoughtWorksInc/Binding.scala#custom-attributes
from binding.scala.
Fixed in #110
from binding.scala.
Related Issues (20)
- FXML: Enable opening pop-up window at a specified location
- Null cache exception in FlatMap HOT 8
- Entity references in attribute values do not compile
- Referring to non-existent method com.thoughtworks.binding.FutureBinding$.apply(scala.concurrent.Future,scala.concurrent.ExecutionContext) HOT 1
- Event handlers in custom tags HOT 1
- data prefix does not (it should) set the attribute to null if the initial value is null HOT 1
- FutureBinding compare with React hooks HOT 1
- Make Binding.value be public HOT 16
- Vars.all is not triggerred HOT 2
- := deprecated, how to use value_= ? HOT 3
- dom module is missing for version `12.0.0-M0` HOT 1
- V12 eta HOT 2
- Vars size binding HOT 3
- Conversion from Binding[Iterable[A]] to BindingSeq[A] HOT 4
- Using BindingSeq in an implicit value class HOT 1
- Use @html to create a table, what is returned is scala.xml.NodeBuffer, and what is needed is BindableSeq[org.scalajs.dom.Node], how to convert? HOT 4
- Dependency `scalajs-dom` is out dated HOT 1
- The last element in HTML interpolation are inserted twice (Binding.scala 13.x)
- Code in `ReadMe.md` failed for unkonow reason. HOT 8
- Support for `Scala.js1.x` & `Scala2.12`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binding.scala.