Questions tagged [mithril.js]

Mithril.js is a client-side MVC framework.

Mithril.js is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.

Some features include

  • Safe-by-default templates
  • Hierarchical MVC via components
  • Virtual DOM diffing and compilable templates
  • Intelligent auto-redrawing system

Official page and resources: http://mithril.js.org/

260 questions
0
votes
1 answer

How would one get browser height in Mithril.js for dynamic allocation

So I have a dropdown and am trying to give it a dynamic height; how would this be possible using mithril.js? This is what I have tried so far: This is a snippet of code where I am trying to give the list a dynamic height. The end goal is to have the…
animesh manglik
  • 755
  • 7
  • 14
0
votes
2 answers

How do I operate the m.withAttr tutorials code?

A contrived example of bi-directional data binding var user = { model: function(name) { this.name = m.prop(name); }, controller: function() { return {user: new user.model("John Doe")}; }, view:…
re6
  • 37
  • 1
  • 5
0
votes
1 answer

Accept header precedence with spring-data-rest

I am trying spring-data-rest with mithril.js. However, I keep getting xml response from the repository instead of json. I have this repository: @RepositoryRestResource(collectionResourceRel = "people", path = "people") public interface…
0
votes
2 answers

How use Mithril's m.request to load data from a server?

I want to store blocks of a json file into an array. Here is my current code, in controller (ctrl) : var ctrl = this; var id = (location.href).replace(/.*\//g, ''); //use m.route() ? ctrl.list = []; m.request({method: "GET", url:…
user4034421
0
votes
1 answer

What is the difference between method m () and m.render () ? m.render() is always required?

m() makes virtualDom? m.render() makes realDom? That means m.render() is always required?
re96
  • 41
  • 1
  • 6
0
votes
1 answer

How do I check the dragdrop.html?

I want to check the link destination code. https://github.com/lhorie/mithril.js/blob/next/dragdrop.html Anyway, it was changed as follows, is it necessary to write something on the server side (PHP)? //url: "http://localhost/api/files", url:…
re96
  • 41
  • 1
  • 6
0
votes
1 answer

m.request: use URL which contains colons

I have a m.request call like this: mCmdName = "cn:cmd:list:deselectAll"; m.request({ method : "POST", url : "/testing/cmd/" + mCmdName, data: data }); Now m.request calls xhrOptions.url =…
0
votes
1 answer

Trouble getting m.request to auto-cast to a class in Mithril

I have defined a class and am asking m.request to cast a web service's JSON response to it, but each of the class properties come out equal to n/b(), and my view renders each property as function (){return arguments.length&&(a=arguments[0]),a}. If I…
Peaeater
  • 626
  • 5
  • 19
0
votes
1 answer

m.request with deserialization property is not returning a string

As per the example in API documentation, I am trying to use the m.request utility (with the deserialization flag set) to grab the contents of a .txt file as a string; var file = m.request({ method: 'GET', url: 'file.txt', // deserialize:…
axdg
  • 4,025
  • 3
  • 13
  • 7
0
votes
1 answer

Call Async Load Module Function from View

I'm trying to asynchronously load a JS file on demand (on user input), that contains another mithril module, with the asynchronous module loader technique described at http://lhorie.github.io/mithril-blog/integrating-mithril-and-requirejs.html The…
humand
  • 53
  • 4
0
votes
2 answers

Mithril js - cross component communication pattern

I have a different implementation of cross-component communication here http://jsfiddle.net/c641oog2/ than what's described here: http://lhorie.github.io/mithril/components.html#librarization. The goal is to create an easily integrable & scalable…
0
votes
1 answer

Firefox empties documentFragment on clone

I've found this strange scenario where Firefox seems to loose the content of a documentFragment after cloning it (with the deep flag set to true). Is this a Firefox bug, or am I missing an implementation detail? var n = ( function nScope(){ 'use…
Barney
  • 16,181
  • 5
  • 62
  • 76
0
votes
2 answers

Why won't my MithrilJS UI render unless I call redraw after a programmatic redirect?

Here is a snippet of view code. Why won't it work without the m.redraw()? If I don't call that, the route changes and the login controller loads, but nothing is rendered into the DOM. home.view = function(ctrl) { console.log('in home view'); …
jtmanteo
  • 151
  • 7
0
votes
1 answer

How can I clear this text box?

The following mithril code is meant to clear a text box upon pulling a value from it. It doesn't clear the text box (or do anything at all). How can I make it work? Note that if I change this line: this.newItemName(""); to: …
Lyn Headley
  • 11,368
  • 3
  • 33
  • 35
-1
votes
1 answer

Having issue of rendering Mapbox map from any ID other than "app"

I'm trying to implement Mapbox gl gs into a project I'm building with Mithril and am having issues with getting a map to render from any ID other then "app". Within the body of my html I have a div called app so it makes sense why that works. The…
1 2 3
17
18