Created
December 9, 2016 20:35
-
-
Save Hecatoncheir/b67d841c184a8256671d44947ffdddd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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