Dart Example

AngularDart v4 Interpolation,2way data binding

AngularDart v4 Sample Code,Demo
Loading…
(html)
<head>
.....
  <script defer src="main.dart" type="application/dart"></script>
  <script defer src="packages/browser/dart.js"></script>
</head>
<body>
  <my-app>Loading...</my-app>
</body>

(pubspec.yaml)
.....
environment:
  sdk: '>=1.24.0 

    
import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';

@Component(
  selector: 'my-app',
  template: '''
<strong>1)Interpolation</strong>
<div>(Double wave brackets)   Country:{{country}},  Gender:{{gender}}</div>
<div ngNonBindable>(ngNonBindable)  {{xxxxxx}}</div>
  <br />
<strong>2)2way data binding</strong>
<div>Name:{{name}}</div>
Input:<input [(ngModel)]="name" placeholder="name">
    ''',
  directives: const [formDirectives,CORE_DIRECTIVES],
)
class AppComponent {
  String country = "Japan";
  String gender = "woman";
  String name = "sample";
}

void main() {
  bootstrap(AppComponent);
}
Exit mobile version