Skip to content

Instantly share code, notes, and snippets.

@Thanood
Created November 4, 2016 10:09
Show Gist options
  • Save Thanood/efaf578e706f1aa0d68faf3cad79c51e to your computer and use it in GitHub Desktop.
Save Thanood/efaf578e706f1aa0d68faf3cad79c51e to your computer and use it in GitHub Desktop.
md-label on md-input not rendered good in mobile
<template>
<require from="materialize/dist/css/materialize.css"></require>
<require from="./my-form"></require>
<my-form></my-form>
</template>
export class App {
activePage = 1;
setToFive() {
this.activePage = 5;
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script>
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-materialize-bundles/0.18.0/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
/*******************************************************************************
* The following two lines enable async/await without using babel's
* "runtime" transformer. Uncomment the lines if you intend to use async/await.
*
* More info here: https://github.com/jdanyow/aurelia-plunker/issues/2
*/
//import regeneratorRuntime from 'babel-runtime/regenerator';
//window.regeneratorRuntime = regeneratorRuntime;
/******************************************************************************/
import 'materialize';
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-materialize-bridge', bridge => bridge.useAll() );
aurelia.start().then(a => a.setRoot());
}
<template>
<form submit.delegate="save()">
<div class="row">
<div class="col s12 right-align">
<button type="submit" md-waves class="btn-floating"><i class="material-icons">save</i></button>
</div>
</div>
<md-card md-title="Client">
<div class="row">
<div class="col s12">
<select md-select="label: Client" value.two-way="selectedClient" md-select.ref="clientSelect">
<option value="" disabled selected>Select a client...</option>
<option repeat.for="client of clients" value.bind="client.ID">${client.name}</option>
</select>
</div>
</div>
</md-card>
<md-card md-title="Time">
<div class="row">
<div class="col s12 m6 input-field">
<label for="startDate">Start Date</label>
<input id="startDate" md-datepicker="container: body; value.two-way: startDate;'" type="date" placeholder="Start Date" />
</div>
<div class="col s6 m6 input-field">
<label for="startTime" class="active">Start Time</label>
<input id="startTime" type="time" value.two-way="start" required />
</div>
</div>
</md-card>
<md-card md-title="Informations">
<div class="row">
<div class="col s12">
<md-input md-label="Comment" md-value.bind="comment" md-text-area="true"></md-input>
</div>
</div>
<div class="row">
<div class="col s12">
Break :
<md-switch md-checked.bind="showBreak" md-label-on="Yes" md-label-off="No"></md-switch>
</div>
</div>
<div class="row ${showBreak ? '' : 'hide'}">
<div class="col s12 m3 input-field">
<label for="breakTimeID" class="active">Break Time</label>
<input id="breakTimeID" type="time" value.two-way="breakTime" />
</div>
<div class="col s12 m9 input-fiel">
<md-input md-label="Break Reason" md-value.bind="breakReason"></md-input>
</div>
</div>
<div class="row">
<div class="col s12">
Train
<md-switch md-checked.bind="showTrain" md-label-on="Yes" md-label-off="No"></md-switch>
</div>
</div>
<div class="row ${showTrain ? '' : 'hide'}">
<div class="col s6 input-field">
<label for="trainTimeID" class="active">Train Time</label>
<input id="trainTimeID" type="time" value.two-way="trainTime" />
</div>
<div class="col s6">
<md-input md-type="number" md-step="any" md-label="Train Price" md-validate="true" md-validate-error="invalid number" md-value.bind="trainPrice"></md-input>
</div>
</div>
</md-card>
</form>
</template>
import {observable} from 'aurelia-framework';
export class MyForm {
showBreak = true;
showTrain = true;
clients = [{ID: 0, name: 'Client 1'}, {ID: 1, name: 'Client 2'}]
constructor() {
}
attached() {
}
save() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment