Skip to content

Instantly share code, notes, and snippets.

@Hecatoncheir
Created December 9, 2016 20:35
Show Gist options
  • Select an option

  • Save Hecatoncheir/b67d841c184a8256671d44947ffdddd5 to your computer and use it in GitHub Desktop.

Select an option

Save Hecatoncheir/b67d841c184a8256671d44947ffdddd5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Without check example</title>
<script defer src="without_check.dart" type="application/dart"></script>
<script defer src="packages/browser/dart.js"></script>
</head>
<body>
<host></host>
</body>
</html>
library without_check_example;
import 'dart:async';
import 'dart:convert';
import 'package:angular2/angular2.dart';
import 'package:angular2/platform/browser.dart';
@Component(selector: 'child')
@View(
template: """
<div>Message: {{message}}, message count: {{messageCount}}</div>
""")
class Child {
int messageCount = 0;
String message;
@Input('message')
set messageChanged(String newMessage) {
message = newMessage;
messageCount += 1;
}
}
@Component(selector: 'host')
@View(
template: """
<child [message]='message'></child>
""",
directives: const [Child])
class Host implements OnInit {
String message;
@override
Future ngOnInit() async {
new Timer.periodic(new Duration(seconds: 1), (Timer time) {
message = 'Up!';
});
}
}
@AngularEntrypoint()
Future main() async {
bootstrap(Host);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment