0

Using ng-for in the following code produces an error on the JavaScript Console of the browser when executed. The error is: An error occurred loading file: package:pe2/show_properties.ng_deps.dart

library pe.show_properties;
import 'package:angular2/angular2.dart';
import 'package:pe2/friends_service.dart';
@Component(selector: 'display', viewProviders: const [FriendsService])
@View(template: '''
<p>My name: {{ myName }}</p>
<p>Friends:</p>
<ul>
   <li *ng-for="#name of friendNames">
      {{ name }}
   </li>
</ul>
<p *ng-if="friendNames.length > 3">You have many friends!</p>
''', directives: const [NgFor, NgIf])
class DisplayComponent {
  String myName = 'Alice';
  List<String> friendNames;
  DisplayComponent(FriendsService friendsService) {
    friendNames = friendsService.names;
  }
}

library pe2.friends_service;
import 'package:angular2/angular2.dart';
@Injectable()
class FriendsService {
  List<String> names = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai'];
}
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
user3329151
  • 145
  • 1
  • 1
  • 5
  • Possible duplicate of [Can't bind to 'ng-forOf' since it isn't a known native property](http://stackoverflow.com/questions/34228971/cant-bind-to-ng-forof-since-it-isnt-a-known-native-property) – Günter Zöchbauer Jan 19 '16 at 10:01

1 Answers1

0

If you use alpha 52, check out the CHANGELOG.md in the GitHub repo. They changed the template to case-sensitive which is ngFor instead of ng-for (similar for all other directives)

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567