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
18
votes
2 answers

How does Mithril and jQuery interact with each other?

I am using Mithril as our MVC framework & I want to leverage of rich JQuery/Jquery UI functionalities. I would like to understand the 'Do's and Don't's' when combining jQuery with Mithril What I understand is, I can use Mithril config to access the…
chifer
  • 683
  • 5
  • 19
11
votes
2 answers

How do I show a spinner while waiting for an AJAX request in Mithril JS?

I'm using Mithril JS in a project and I'm having trouble understanding exactly how to go about hooking into the Ajax lifecycle. Like if I have an Ajax request takes awhile, I want to show a spinner. Pretty basic, but I can't seem to figure out how…
Jeff Miller
  • 173
  • 1
  • 10
8
votes
1 answer

Onclick event not running on first button click in Mithril

Why does the "click" callback not invoked the first time after some text is entered into the input like in this fiddle? var app = {}; app.controller = function(){ this.data = m.prop(""); this.click = function(){ alert("button…
Csati
  • 1,251
  • 1
  • 15
  • 28
8
votes
3 answers

How would I bind keypresses for an app?

mithril talks plenty about binding and eventing if they are simple variable changes, but what about binding say the + key to functionality? I tried m.withAttr('keyCode') binding to the controller method that I wanted to handle it, but…
Maslow
  • 18,464
  • 20
  • 106
  • 193
6
votes
3 answers

Mithril.js multiple css class

I'm new at mithril.js. I have a div, I want to add class "invalid" if ctrl.invalid()==true, and "hidden" if ctrl.hidden()==true. If I use m('div', {class: ctrl.invalid() ? 'invalid' : '', class: ctrl.hidden()? 'hidden' : ''}), they override each…
real
  • 491
  • 4
  • 17
6
votes
2 answers

How Do I Overlay a Popup View in Mithril.js?

As a practical exercise in learning bare-bones JS programming in depth (on up to date browsers), I am building an SPA to maintain customer records. The only external library I am using is Mithril.js MVC. So far I have got a table view with live data…
Lawrence Dol
  • 63,018
  • 25
  • 139
  • 189
5
votes
3 answers

How to convert a string into a HTML element in Mithril?

Suppose I have a string Text goes here.I need to use this string as a HTML element in my webpage. Any ideas on how to do it?
Mohit
  • 51
  • 3
5
votes
1 answer

compass not working with mithril yeoman generator

I am trying to run the Mithril yeoman generator unfortunately it falls over on grunt serve with the error Warning: Running "compass:server" (compass) task Warning: Couldn't find the compass binary. Make sure it's installed ... I can of course use…
svnm
  • 22,878
  • 21
  • 90
  • 105
4
votes
1 answer

Cannot get response content in mithril

I've been trying to make a request to a NodeJS API. For the client, I am using the Mithril framework. I used their first example to make the request and obtain data: var Model = { getAll: function() { return m.request({method: "GET",…
mignz
  • 3,648
  • 2
  • 20
  • 21
4
votes
3 answers

MithrilJS: Routing a component inside top level component

I just started reading about Mithril. Fascinating.. Just one thing that puzzles me after first read. How can I route one component inside another (top-level component)? I mean, how do I emulate angulars ng-view or embers outlet? I understand that I…
r.sendecky
  • 9,933
  • 9
  • 34
  • 62
4
votes
1 answer

How to integrate custom context menus in Mithril

I'm trying to add custom contextmenus to some of the elements in a page and did it like this in a view which contains a table. The contextmenu is attached to the table header with the name "S": list.view = function(ctrl, args) { var…
4
votes
1 answer

Mithril ajax wrapper, m.request, converts failures to success

This may well be some newbie thing about JS and or Mithril that I am unaware of, but I have written a caching wrapper around Mithril's m.request() to track multiple pending requests with the intention of coalescing multiple identical requests (which…
Lawrence Dol
  • 63,018
  • 25
  • 139
  • 189
3
votes
2 answers

How to change contents of a virtual dom element in Mithril?

How do I access a virtual dom element to change its contents using Mithril? I am new to Mithril and still trying to figure things out. For example, I want to access the third div with id "three" and change it's contents to "Blue Jays" without…
3
votes
1 answer

(Mithril) TypeError: m is not a function... 'm' is an instance of Object

I am a new FronT-end developer learning "Mithril JS". I created sample page using MVC Pattern. The page is not working after console error in NavBar.js (see below): TypeError: m is not a function. (In 'm("div", "Hello")', 'm' is an instance of…
gimazu
  • 31
  • 3
3
votes
2 answers

stop mithrill redraw on first action

I'm writing a single page application using mithril. The page loads some data from the server using m.request() in the oninit of the main component: var root = document.getElementById("main"); var Data = { fetch: function () { …
RekaB
  • 438
  • 5
  • 14
1
2 3
17 18