parent
166688348a
commit
450d3630cc
|
@ -20,7 +20,3 @@ declare module ng {
|
|||
interface InjectableReference {}
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
declare module "angular2/angular2" {
|
||||
export = ng;
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ declare module ng {
|
|||
{% endfor %}
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
declare module "angular2/angular2" {
|
||||
declare module "{$ alias $}" {
|
||||
export = ng;
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
|
|
@ -761,7 +761,7 @@ gulp.task('!pre.test.typings', ['docs/typings'], function() {
|
|||
|
||||
// -----------------
|
||||
gulp.task('test.typings', ['!pre.test.typings'], function() {
|
||||
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/angular2.d.ts'])
|
||||
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts'])
|
||||
.pipe(tsc({target: 'ES5', module: 'commonjs',
|
||||
experimentalDecorators: true,
|
||||
noImplicitAny: true,
|
||||
|
|
|
@ -16,8 +16,10 @@ export {HTML5LocationStrategy} from './src/router/html5_location_strategy';
|
|||
export {Location, appBaseHrefToken} from './src/router/location';
|
||||
export {Pipeline} from './src/router/pipeline';
|
||||
export * from './src/router/route_config_decorator';
|
||||
export * from './src/router/route_definition';
|
||||
export {OnActivate, OnDeactivate, OnReuse, CanDeactivate, CanReuse} from './src/router/interfaces';
|
||||
export {CanActivate} from './src/router/lifecycle_annotations';
|
||||
export {Instruction} from './src/router/instruction';
|
||||
|
||||
import {LocationStrategy} from './src/router/location_strategy';
|
||||
import {HTML5LocationStrategy} from './src/router/html5_location_strategy';
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
import {makeDecorator} from 'angular2/src/util/decorators';
|
||||
import {CanActivate as CanActivateAnnotation} from './lifecycle_annotations_impl';
|
||||
import {Promise} from 'angular2/src/facade/async';
|
||||
import {Instruction} from 'angular2/src/router/instruction';
|
||||
|
||||
export {
|
||||
canReuse,
|
||||
|
@ -14,4 +16,6 @@ export {
|
|||
onDeactivate
|
||||
} from './lifecycle_annotations_impl';
|
||||
|
||||
export var CanActivate = makeDecorator(CanActivateAnnotation);
|
||||
export var CanActivate:
|
||||
(hook: (next: Instruction, prev: Instruction) => Promise<boolean>| boolean) => ClassDecorator =
|
||||
makeDecorator(CanActivateAnnotation);
|
||||
|
|
|
@ -9,6 +9,6 @@ export class LocationStrategy {
|
|||
pushState(ctx: any, title: string, url: string): void { throw _abstract(); }
|
||||
forward(): void { throw _abstract(); }
|
||||
back(): void { throw _abstract(); }
|
||||
onPopState(fn: (_) => any): void { throw _abstract(); }
|
||||
onPopState(fn: (_: any) => any): void { throw _abstract(); }
|
||||
getBaseHref(): string { throw _abstract(); }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import {RouteConfig as RouteConfigAnnotation} from './route_config_impl';
|
||||
import {RouteConfig as RouteConfigAnnotation, RouteDefinition} from './route_config_impl';
|
||||
import {makeDecorator} from 'angular2/src/util/decorators';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
|
||||
export {Route, Redirect, AsyncRoute, RouteDefinition} from './route_config_impl';
|
||||
export var RouteConfig = makeDecorator(RouteConfigAnnotation);
|
||||
export var RouteConfig: (configs: List<RouteDefinition>) => ClassDecorator =
|
||||
makeDecorator(RouteConfigAnnotation);
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
///<reference path="../dist/docs/typings/angular2/angular2.d.ts"/>
|
||||
///<reference path="../dist/docs/typings/angular2/router.d.ts"/>
|
||||
|
||||
import {Component, bootstrap, View} from 'angular2/angular2';
|
||||
import {RouteConfig, routerDirectives, routerInjectables} from 'angular2/router';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app'
|
||||
})
|
||||
@View({
|
||||
template: '<h1>Hello</h1>',
|
||||
})
|
||||
class FooCmp {
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'my-app'
|
||||
})
|
||||
@View({
|
||||
template: '<h1>Hello {{ name }}</h1><router-outlet></router-outlet>',
|
||||
directives: routerDirectives
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/home', component: FooCmp}
|
||||
])
|
||||
class MyAppComponent {
|
||||
name: string;
|
||||
|
||||
constructor() { this.name = 'Alice'; }
|
||||
}
|
||||
|
||||
bootstrap(MyAppComponent, routerInjectables);
|
Loading…
Reference in New Issue