New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ng] drop `platform_directives` and `platform_pipes` from example pubspecs #625

Merged
merged 17 commits into from May 16, 2017
@@ -10,9 +10,5 @@ dev_dependencies:
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -14,9 +14,5 @@ dev_dependencies:

transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
Whitespace-only changes.
@@ -1,10 +1,12 @@
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';

@Component(
selector: 'hero-detail',
templateUrl: 'hero_detail_component.html')
templateUrl: 'hero_detail_component.html',
directives: const [COMMON_DIRECTIVES],
)
class HeroDetailComponent {
@Input()
Hero hero;
@@ -1,4 +1,4 @@
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';
import 'hero_detail_component.dart';
@@ -8,9 +8,9 @@ import 'hero_service.dart';
@Component(
selector: 'hero-list',
templateUrl: 'hero_list_component.html',
directives: const [HeroDetailComponent],
directives: const [COMMON_DIRECTIVES, HeroDetailComponent],
// #docregion providers
providers: const [HeroService]
providers: const [HeroService],
// #enddocregion providers
)
// #docregion class
@@ -9,14 +9,14 @@ import 'logger_service.dart';
class HeroService {
final BackendService _backendService;
final Logger _logger;
final List<Hero> heroes = [];
final heroes = <Hero>[];

HeroService(this._logger, this._backendService);

List<Hero> getHeroes() {
_backendService.getAll(Hero).then((heroes) {
_logger.log('Fetched ${heroes.length} heroes.');
this.heroes.addAll(heroes); // fill cache
this.heroes.addAll(heroes as List<Hero>); // fill cache

This comment has been minimized.

@kwalrath

kwalrath May 16, 2017

Member

Why is as List<Hero> necessary? I'd rather type it explicitly than have to use as.

This comment has been minimized.

@chalin

chalin May 16, 2017

Collaborator

I think that the checks might have become stricter. The problem is that _backendService .getAll() returns a Future<List> ... i.e., Future<List<dynamic>>. Hence the necessity for the cast.

There is quite a few things that I don't like about this code, but I chose to do only minimal changes for now.

This comment has been minimized.

@kwalrath

kwalrath May 16, 2017

Member

I thought maybe this was related to removing the explicit typing of heroes up above. But if not... carry on.

});
return heroes;
}
@@ -1,4 +1,4 @@
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'sales_tax_service.dart';
import 'tax_rate_service.dart';
@@ -14,7 +14,9 @@ import 'tax_rate_service.dart';
{{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}
</div>
''',
providers: const [SalesTaxService, TaxRateService])
directives: const [CORE_DIRECTIVES],
providers: const [SalesTaxService, TaxRateService],
pipes: const [COMMON_PIPES])
class SalesTaxComponent {
SalesTaxService _salesTaxService;

@@ -2,5 +2,5 @@ import 'package:angular2/core.dart';

@Injectable()
class TaxRateService {
getRate(String rateName) => 0.10;
num getRate(String rateName) => 0.10;
}
@@ -11,9 +11,5 @@ dev_dependencies:
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -11,9 +11,5 @@ dev_dependencies:
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -18,5 +18,6 @@ import 'quest_summary_component.dart';
QuestSummaryComponent
])
class HeroAppMainComponent {
@Input() Hero hero;
@Input()
Hero hero;
}
@@ -13,6 +13,7 @@ import 'hero_team_component.dart';
directives: const [HeroTeamComponent])
class HeroDetailsComponent {
// #enddocregion styleurls
@Input() Hero hero;
@Input()
Hero hero;
// #docregion styleurls
}
@@ -1,4 +1,4 @@
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';
import 'hero.dart';

// #docregion stylelink
@@ -11,7 +11,10 @@ import 'hero.dart';
<li *ngFor="let member of hero.team">
{{member}}
</li>
</ul>''')
</ul>''',
directives: const [CORE_DIRECTIVES],
)
class HeroTeamComponent {
@Input() Hero hero;
@Input()
Hero hero;
}
@@ -11,9 +11,5 @@ dev_dependencies:
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -1,4 +1,4 @@
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'app_config.dart';
import 'car/car_component.dart';
@@ -26,6 +26,7 @@ import 'providers_component.dart';
<my-providers></my-providers>
''',
directives: const [
CORE_DIRECTIVES,
CarComponent,
HeroesComponent,
InjectorComponent,
@@ -1,5 +1,5 @@
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';
import 'hero_service.dart';
@@ -10,7 +10,9 @@ import 'hero_service.dart';
<div *ngFor="let hero of heroes">
{{hero.id}} - {{hero.name}}
({{hero.isSecret ? 'secret' : 'public'}})
</div>''')
</div>''',
directives: const [CORE_DIRECTIVES],
)
class HeroListComponent {
final List<Hero> heroes;

@@ -1,5 +1,5 @@
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';
import 'mock_heroes.dart';
@@ -9,7 +9,9 @@ import 'mock_heroes.dart';
template: '''
<div *ngFor="let hero of heroes">
{{hero.id}} - {{hero.name}}
</div>''')
</div>''',
directives: const [CORE_DIRECTIVES],
)
class HeroListComponent {
final List<Hero> heroes = HEROES;
}
@@ -1,6 +1,6 @@
// #docplaster
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';
// #enddocregion
@@ -17,12 +17,13 @@ import 'hero_service.dart';
template: '''
<div *ngFor="let hero of heroes">
{{hero.id}} - {{hero.name}}
</div>''')
</div>''',
directives: const [CORE_DIRECTIVES],
)
class HeroListComponent {
final List<Hero> heroes;

// #docregion ctor
HeroListComponent(HeroService heroService)
: heroes = heroService.getHeroes();
HeroListComponent(HeroService heroService) : heroes = heroService.getHeroes();

This comment has been minimized.

@kwalrath

kwalrath May 16, 2017

Member

This seems long. What line length are you using? Have you confirmed that it displays OK at common browser widths?

This comment has been minimized.

@chalin

chalin May 16, 2017

Collaborator

No, I just ran the formatter from within WS.

// #enddocregion ctor
}
@@ -12,9 +12,5 @@ dev_dependencies:
test: any
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -1,5 +1,5 @@
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';

@@ -17,7 +17,9 @@ import 'hero.dart';
// #docregion message
<p *ngIf="heroes.length > 3">There are many heroes!</p>
// #enddocregion message
''')
''',
directives: const [CORE_DIRECTIVES],
)
class AppComponent {
String title = 'Tour of Heroes';
List<Hero> heroes = [
@@ -1,5 +1,5 @@
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

@Component(
selector: 'my-app',
@@ -15,8 +15,9 @@ import 'package:angular2/core.dart';
</li>
// #enddocregion li
</ul>
'''
''',
// #enddocregion template
directives: const [CORE_DIRECTIVES],
)
// #docregion class
class AppComponent {
@@ -1,5 +1,5 @@
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';
// #docregion import
import 'hero.dart';
// #enddocregion import
@@ -16,8 +16,9 @@ import 'hero.dart';
{{ hero.name }}
</li>
</ul>
'''
''',
// #enddocregion template
directives: const [CORE_DIRECTIVES],
)
// #docregion class
class AppComponent {
@@ -11,9 +11,5 @@ dev_dependencies:
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -1,7 +1,6 @@
// #docplaster
// #docregion , v1, final
import 'package:angular2/core.dart';
import 'package:angular2/common.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';

@@ -14,7 +13,9 @@ const List<String> _powers = const [

@Component(
selector: 'hero-form',
templateUrl: 'hero_form_component.html')
templateUrl: 'hero_form_component.html',
directives: const [COMMON_DIRECTIVES],
)
class HeroFormComponent {
List<String> get powers => _powers;
Hero model = new Hero(18, 'Dr IQ', _powers[0], 'Chuck Overstreet');
@@ -11,9 +11,5 @@ dev_dependencies:
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
@@ -1,5 +1,5 @@
// #docregion
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'car_components.dart';
import 'heroes_list_component.dart';
@@ -20,6 +20,7 @@ import 'villains_list_component.dart';
<my-cars *ngIf="showCars"></my-cars>
''',
directives: const [
CORE_DIRECTIVES,
carComponents,
HeroesListComponent,
VillainsListComponent
@@ -1,7 +1,7 @@
// #docregion
import 'dart:async';

import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';
import 'hero_tax_return_service.dart';
@@ -31,6 +31,7 @@ import 'hero_tax_return_service.dart';
</div>
''',
styleUrls: const ['hero_tax_return_component.css'],
directives: const [COMMON_DIRECTIVES],
// #docregion providers
providers: const [HeroTaxReturnService])
// #enddocregion providers
@@ -1,6 +1,6 @@
// #docregion
import 'dart:async';
import 'package:angular2/core.dart';
import 'package:angular2/angular2.dart';

import 'hero.dart';
import 'heroes_service.dart';
@@ -24,7 +24,9 @@ import 'hero_tax_return_component.dart';
</div>
''',
styles: const ['li {cursor: pointer;}'],
directives: const [HeroTaxReturnComponent])
directives: const [CORE_DIRECTIVES, HeroTaxReturnComponent],
pipes: const [COMMON_PIPES],
)
class HeroesListComponent {
final HeroesService _heroesService;

Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.