Aurelia is a JavaScript client framework for mobile, desktop and web leveraging simple conventions and empowering creativity.
Lead by Rob Eisenberg
Developed by a dedicated team of leads and core developers with hundreds of contributions from the open source community
All the usual things you'd expect in a modern application framework
<!DOCTYPE html>
<html>
<head>
<title>Aurelia</title>
</head>
<body aurelia-app="src/main">
<script src="scripts/system.js"></script>
<script src="scripts/config-typescript.js"></script>
<script src="scripts/aurelia-core.min.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
src/main.ts
import {Aurelia} from 'aurelia-framework';
export function configure(aurelia: Aurelia) {
aurelia.use.basicConfiguration();
aurelia.start().then(() => aurelia.setRoot());
}
The root container of our application.
In Aurelia, a component is a view and view-model pair. The view is for your UI markup and is written in HTML and the view-model is a TypeScript (or JavaScript) class that contains the UI logic.
by convention, they have the same file name with the .html extension for the view and .ts (or .js) extension for the view-model
src/app.ts
export class App {
message = "Hello from Aurelia!"
}
src/app.html
${message}
Hello, ${friend}!
${person.name}
some content
some content
import {RouterConfiguration, Router} from 'aurelia-router';
export class App {
configureRouter(config: RouterConfiguration, router: Router): void {
this.router = router;
config.title = 'Aurelia';
config.map([
{ route: ['', 'home'], name: 'home', moduleId: 'home/index', nav: true },
{ route: 'users', name: 'users', moduleId: 'users/index', nav: true },
{ route: 'users/:id/detail', name: 'userDetail', moduleId: 'users/detail' }
]);
}
}
import {RouteConfig} from 'aurelia-router';
export class UserDetail {
activate(params: any, routeConfig: RouteConfig): Promise<any> {
//the id parameter from the route will be in params.id
}
}
Everyhthing is injectable and most things can be injected
import {RouteConfig} from 'aurelia-router';
import {autoinject} from 'aurelia-framework';
import {UserService} from 'services/user-service';
@autoinject
export class UserDetail {
constructor(private userService: UserService){}
activate(params: any, routeConfig: RouteConfig): Promise<any> {
return this.userService.getUser(params.id).then(users => {
this.users = users;
})
}
}
Two easy ways to get started: Skeleton Projects and the CLI
Any Questions?