angular/modules/examples/src/observable_models/app.dart
Jeff Cross f14b212dc9 refactor: export core APIs from angular2/core
This change moves many APIs to the angular2/core export.

This change also automatically adds FORM_BINDINGS in
the application root injector.

BREAKING CHANGE:
    Many dependencies that were previously exported from specific
    APIs are now exported from angular2/core. Affected exports, which
    should now be included from angular2/core include:

    angular2/forms
    angular2/di
    angular2/directives
    angular2/change_detection
    angular2/bootstrap (except for dart users)
    angular2/render
    angular2/metadata
    angular2/debug
    angular2/pipes
Closes #3977
2015-09-05 07:01:34 +00:00

39 lines
1.3 KiB
Dart

library benchmarks.src.naive_infinite_scroll.app;
import "package:angular2/src/core/facade/collection.dart" show List, ListWrapper;
import "scroll_area.dart" show ScrollAreaComponent;
import "package:angular2/angular2.dart" show Component, Directive, View, IterableDiffers, SkipSelf, Binding;
import "package:angular2/core.dart" show ObservableListDiffFactory, NgIf, NgFor;
import 'package:observe/observe.dart' show ObservableList;
createDiffers(IterableDiffers parent) {
return IterableDiffers.create([const ObservableListDiffFactory()], parent);
}
const binding = const Binding(IterableDiffers,
toFactory: createDiffers, deps: const [ const[IterableDiffers, const SkipSelf()]]);
@Component(
selector: "scroll-app",
bindings: const [binding]
)
@View(directives: const [ScrollAreaComponent, NgIf, NgFor], template: '''
<div>
<div style="display: flex">
<scroll-area id="testArea"></scroll-area>
</div>
<div template="ng-if scrollAreas.length > 0">
<p>Following tables are only here to add weight to the UI:</p>
<scroll-area template="ng-for #scrollArea of scrollAreas"></scroll-area>
</div>
</div>''')
class App {
List<int> scrollAreas;
App() {
var scrollAreas = [];
for (var i = 0; i < 300; i++) {
scrollAreas.add(i);
}
this.scrollAreas = new ObservableList.from(scrollAreas);
}
}