@ -16,7 +16,7 @@ import {
|
||||
|
||||
import {SpyRouter, SpyLocation} from '../spies';
|
||||
|
||||
import {provide, Component, View} from 'angular2/core';
|
||||
import {provide, Component} from 'angular2/core';
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
|
||||
import {
|
||||
@ -102,15 +102,14 @@ export function main() {
|
||||
});
|
||||
}
|
||||
|
||||
@Component({selector: 'user-cmp'})
|
||||
@View({template: "hello {{user}}"})
|
||||
@Component({selector: 'user-cmp', template: "hello {{user}}"})
|
||||
class UserCmp {
|
||||
user: string;
|
||||
constructor(params: RouteParams) { this.user = params.get('name'); }
|
||||
}
|
||||
|
||||
@Component({selector: 'test-component'})
|
||||
@View({
|
||||
@Component({
|
||||
selector: 'test-component',
|
||||
template: `
|
||||
<div>
|
||||
<a [routerLink]="['/Detail']"
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component, Directive, View} from 'angular2/src/core/metadata';
|
||||
import {Component, Directive} from 'angular2/src/core/metadata';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {provide, ViewChild, AfterViewInit} from 'angular2/core';
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {provide, Component, Injector, Inject, View} from 'angular2/core';
|
||||
import {provide, Component, Injector, Inject} from 'angular2/core';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {
|
||||
PromiseWrapper,
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {provide, Component, View, Injector, Inject} from 'angular2/core';
|
||||
import {provide, Component, Injector, Inject} from 'angular2/core';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData, Location} from 'angular2/router';
|
||||
|
@ -22,7 +22,7 @@ import {NumberWrapper} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {provide, Component, View, DirectiveResolver} from 'angular2/core';
|
||||
import {provide, Component, DirectiveResolver} from 'angular2/core';
|
||||
|
||||
import {SpyLocation} from 'angular2/src/mock/location_mock';
|
||||
import {
|
||||
@ -69,10 +69,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
function compile(template: string = "<router-outlet></router-outlet>") {
|
||||
return tcb.overrideView(MyComp, new View({
|
||||
template: ('<div>' + template + '</div>'),
|
||||
directives: [RouterOutlet, RouterLink]
|
||||
}))
|
||||
return tcb.overrideTemplate(MyComp, ('<div>' + template + '</div>'))
|
||||
.createAsync(MyComp)
|
||||
.then((tc) => { fixture = tc; });
|
||||
}
|
||||
@ -382,7 +379,7 @@ function getHref(tc: ComponentFixture) {
|
||||
return DOM.getAttribute(tc.debugElement.query(By.css('a')).nativeElement, 'href');
|
||||
}
|
||||
|
||||
@Component({selector: 'my-comp'})
|
||||
@Component({selector: 'my-comp', template: '', directives: [ROUTER_DIRECTIVES]})
|
||||
class MyComp {
|
||||
name;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {provide, Provider, Component, View} from 'angular2/core';
|
||||
import {provide, Provider, Component} from 'angular2/core';
|
||||
import {Type, isBlank} from 'angular2/src/facade/lang';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component, Directive, View} from 'angular2/src/core/metadata';
|
||||
import {Component, Directive} from 'angular2/src/core/metadata';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {provide} from 'angular2/core';
|
||||
@ -213,13 +213,15 @@ export function main() {
|
||||
}
|
||||
|
||||
|
||||
@Component({selector: 'hello-cmp'})
|
||||
@View({template: 'hello'})
|
||||
@Component({selector: 'hello-cmp', template: 'hello'})
|
||||
class HelloCmp {
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/before', redirectTo: ['Hello']},
|
||||
{path: '/after', component: HelloCmp, name: 'Hello'}
|
||||
@ -232,8 +234,11 @@ function HelloLoader(): Promise<any> {
|
||||
return Promise.resolve(HelloCmp);
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/hello', component: {type: 'loader', loader: HelloLoader}},
|
||||
])
|
||||
@ -241,8 +246,11 @@ class AsyncAppCmp {
|
||||
constructor(public router: Router, public location: LocationStrategy) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/hello', loader: HelloLoader},
|
||||
])
|
||||
@ -250,15 +258,21 @@ class ConciseAsyncAppCmp {
|
||||
constructor(public router: Router, public location: LocationStrategy) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> } aside { <router-outlet name="aside"></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> } aside { <router-outlet name="aside"></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/hello', component: HelloCmp}, {aux: 'aside', component: HelloCmp}])
|
||||
class AuxAppCmp {
|
||||
constructor(public router: Router, public location: LocationStrategy) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/hello', component: {type: 'constructor', constructor: HelloCmp}},
|
||||
])
|
||||
@ -266,45 +280,66 @@ class ExplicitConstructorAppCmp {
|
||||
constructor(public router: Router, public location: LocationStrategy) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'parent-cmp'})
|
||||
@View({template: `parent { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'parent-cmp',
|
||||
template: `parent { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/child', component: HelloCmp}])
|
||||
class ParentCmp {
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/parent/...', component: ParentCmp}])
|
||||
class HierarchyAppCmp {
|
||||
constructor(public router: Router, public location: LocationStrategy) {}
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/hello'}])
|
||||
class WrongConfigCmp {
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/child', component: HelloCmp, name: 'child'}])
|
||||
class BadAliasNameCmp {
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/child', component: HelloCmp, as: 'child'}])
|
||||
class BadAliasCmp {
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([{path: '/child', component: HelloCmp, as: 'Child', name: 'Child'}])
|
||||
class MultipleAliasCmp {
|
||||
}
|
||||
|
||||
@Component({selector: 'app-cmp'})
|
||||
@View({template: `root { <router-outlet></router-outlet> }`, directives: ROUTER_DIRECTIVES})
|
||||
@Component({
|
||||
selector: 'app-cmp',
|
||||
template: `root { <router-outlet></router-outlet> }`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([
|
||||
{path: '/hello', component: {type: 'intentionallyWrongComponentType', constructor: HelloCmp}},
|
||||
])
|
||||
|
Reference in New Issue
Block a user