Skip to content

Instantly share code, notes, and snippets.

@ZoolWay
Last active April 12, 2017 17:17
Show Gist options
  • Save ZoolWay/3da6d6aa70f6cdf84f1fb9b5f2109b6f to your computer and use it in GitHub Desktop.
Save ZoolWay/3da6d6aa70f6cdf84f1fb9b5f2109b6f to your computer and use it in GitHub Desktop.
Aurelia Resize
<template>
<require from="my-comp"></require>
<h1>Aurelia Reisze</h1>
<div ref="areaContainer">
<h2>Component:</h2>
<my-comp title="simple"></my-comp>
<compose view-model="my-comp" model.bind="modelB"></compose>
</div>
<div>
<button click.delegate="to300()">To 300</button>
<button click.delegate="to500()">To 500</button>
</div>
</template>
import { observable } from 'aurelia-framework'
export class App {
modelB = { title: 'inner-compose' };
areaContainer = null;
to300() {
this.areaContainer.style.width = '300px';
}
to500() {
this.areaContainer.style.width = '500px';
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
//require(['https://unpkg.com/element-resize-detector@1.1.11/dist/element-resize-detector']);
//require(['https://unpkg.com/aurelia-resize@1.0.4/dist/amd/index']);
import { resizeable } from 'https://unpkg.com/aurelia-resize@1.0.4/dist/amd/index';
export function configure(aurelia) {
aurelia.use.standardConfiguration(); //.plugin('https://unpkg.com/aurelia-resize@1.0.4/dist/index');
aurelia.start().then(() => aurelia.setRoot());
}
<template>
<div style="font-family:Lucida Console Regular; padding: 1em; background: silver;">
title: '${title}'
</div>
</template>
import { bindable } from 'aurelia-framework'
export class MyComp {
@bindable title = null;
activate(model) {
if ((model) && (model.title)) {
this.title = model.title;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment