Chapter04 issue initially
OK, so I've been using Angular 2.0.0-rc.4 so maybe these are my own fault, but the i18nPlural pipe filter doesn't work with the provided code.
In order to make it work I had to do the following inside the .ts file :
Import the NgLocalization provider
import {
NgLocalization
} from '@angular/common';
Extend the class to define a getPluralCategory method on it
class MessagesLocalization extends NgLocalization {
getPluralCategory(value: any) {
if (value > 1) {
return 'other';
}
}
}
Inject the extended provider in to the bootstrap, although I think you can also add it to the providers key of the component individually
bootstrap(TasksComponent, [{provide: NgLocalization, useClass: MessagesLocalization}]);
Not sure if this area of angular2 just needs further development, or if this is the ideal fix going forward.
There are other angular2 plugins that can be used and injected to make the functionality work.
Chapter04 issue initially
OK, so I've been using Angular
2.0.0-rc.4so maybe these are my own fault, but the i18nPlural pipe filter doesn't work with the provided code.In order to make it work I had to do the following inside the
.tsfile :Import the NgLocalization provider
Extend the class to define a
getPluralCategorymethod on itInject the extended provider in to the bootstrap, although I think you can also add it to the providers key of the component individually
Not sure if this area of angular2 just needs further development, or if this is the ideal fix going forward.
There are other angular2 plugins that can be used and injected to make the functionality work.