feat(decorators): adds decorator versions of DI annotations.
In 'angular2/di' the symbol: - Inject is a decorator - InjectAnnotation is an annotation Internally one an get a hold of annotations without *Annotations appened (to make ts2dart work without workarounds) by importing from 'angular2/src/di/annotations_impl' instead of 'angular2/di'. This is needed only for users that transpile through TS and through ts2dart.
This commit is contained in:
3
modules/angular2/src/di/annotations.dart
Normal file
3
modules/angular2/src/di/annotations.dart
Normal file
@ -0,0 +1,3 @@
|
||||
library angular2.di.annotations;
|
||||
|
||||
export './annotations_impl.dart';
|
13
modules/angular2/src/di/annotations.es6
Normal file
13
modules/angular2/src/di/annotations.es6
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* This indirection is needed to free up Component, etc symbols in the public API
|
||||
* to be used by the decorator versions of these annotations.
|
||||
*/
|
||||
|
||||
export {
|
||||
Inject as InjectAnnotation,
|
||||
InjectPromise as InjectPromiseAnnotation,
|
||||
InjectLazy as InjectLazyAnnotation,
|
||||
Optional as OptionalAnnotation,
|
||||
Injectable as InjectableAnnotation,
|
||||
DependencyAnnotation, // abstract base class, does not need a decorator
|
||||
} from './annotations_impl';
|
2
modules/angular2/src/di/binding.js
vendored
2
modules/angular2/src/di/binding.js
vendored
@ -2,7 +2,7 @@ import {Type, isBlank, isPresent, CONST} from 'angular2/src/facade/lang';
|
||||
import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {Key} from './key';
|
||||
import {Inject, InjectLazy, InjectPromise, Optional, DependencyAnnotation} from './annotations';
|
||||
import {Inject, InjectLazy, InjectPromise, Optional, DependencyAnnotation} from './annotations_impl';
|
||||
import {NoAnnotationError} from './exceptions';
|
||||
|
||||
/**
|
||||
|
3
modules/angular2/src/di/decorators.dart
Normal file
3
modules/angular2/src/di/decorators.dart
Normal file
@ -0,0 +1,3 @@
|
||||
library angular2.di.decorators;
|
||||
|
||||
/* This file is empty because, Dart does not have decorators. */
|
13
modules/angular2/src/di/decorators.es6
Normal file
13
modules/angular2/src/di/decorators.es6
Normal file
@ -0,0 +1,13 @@
|
||||
import {
|
||||
InjectAnnotation,
|
||||
InjectPromiseAnnotation,
|
||||
InjectLazyAnnotation,
|
||||
OptionalAnnotation,
|
||||
InjectableAnnotation} from './annotations';
|
||||
import {makeDecorator, makeParamDecorator} from '../util/decorators';
|
||||
|
||||
export var Inject = makeParamDecorator(InjectAnnotation);
|
||||
export var InjectPromise = makeParamDecorator(InjectPromiseAnnotation);
|
||||
export var InjectLazy = makeParamDecorator(InjectLazyAnnotation);
|
||||
export var Optional = makeParamDecorator(OptionalAnnotation);
|
||||
export var Injectable = makeDecorator(InjectableAnnotation);
|
Reference in New Issue
Block a user