Rendering Views
Rendering Views
Example
app.get('/view', (req, res) async => await res.render('hello', {'locals': ['foo', 'bar']});ViewGenerator
Next Up...
Last updated
app.get('/view', (req, res) async => await res.render('hello', {'locals': ['foo', 'bar']});Last updated
/// A function that asynchronously generates a view from the given path and data.
typedef Future<String> ViewGenerator(String path, [Map data]);import 'dart:io';
import 'package:angel_framework/angel_framework.dart';
Future<void> plugin(Angel app) async {
app.viewGenerator = (String path, [Map data]) async {
return "Requested view $path with locals: $data";
};
}
main() async {
var app = new Angel();
await app.configure(plugin);
await app.startServer();
}