Skip to content

Instantly share code, notes, and snippets.

@kasperpeulen
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasperpeulen/dd353c3d95b2da3dd74b to your computer and use it in GitHub Desktop.
Save kasperpeulen/dd353c3d95b2da3dd74b to your computer and use it in GitHub Desktop.
A basic example showing how to use *ng-if in angular2.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<my-app></my-app>
<script type="application/dart" src="main.dart"></script>
</body>
</html>
import 'package:angular2/angular2.dart';
import 'package:angular2/src/reflection/reflection.dart' show reflector;
import 'package:angular2/src/reflection/reflection_capabilities.dart'
show ReflectionCapabilities;
@Component(selector: 'my-app')
@View(template: '''
<span *ng-if="1+1 == 2">1+1 is indeed 2, very smart!</span>
''', directives: const [NgIf])
class MyApp {}
main() {
reflector.reflectionCapabilities = new ReflectionCapabilities();
bootstrap(MyApp);
}
name: angular2.angular2_NgIf
description: >
A basic example showing how to use *ng-if in angular2.
tags: 'ng-if'
homepage: https://gist.github.com/kasperpeulen/dd353c3d95b2da3dd74b
environment:
sdk: '>=1.0.0 <2.0.0'
dependencies:
angular2: 2.0.0-alpha.32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment