Skip to content

Commit e4389d2

Browse files
aitboudadchristopherthielen
authored andcommitted
feat(ui-view): render default content inside <ui-view>.
Closes angular-ui/ui-router#3023
1 parent c6628fa commit e4389d2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/ng2/directives/uiView.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ const ng2ComponentInputs = (ng2CompClass: Type<any>) => {
109109
*/
110110
@Component({
111111
selector: 'ui-view, [ui-view]',
112-
template: `<template #componentTarget></template>`
112+
template: `
113+
<template #componentTarget></template>
114+
<ng-content *ngIf="!componentRef"></ng-content>
115+
`
113116
// styles: [`
114117
// .done-true {
115118
// text-decoration: line-through;

src/ng2/uiRouterNgModule.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** @module core */ /** */
22
import {Ng2StateDeclaration} from "./interface";
33
import {NgModule, OpaqueToken, ModuleWithProviders, ANALYZE_FOR_ENTRY_COMPONENTS, Provider, Type} from "@angular/core";
4+
import {CommonModule} from "@angular/common";
45
import {_UIROUTER_DIRECTIVES} from "./directives/directives";
56
import {UIView} from "./directives/uiView";
67
import {RawParams} from "ui-router-core";
@@ -31,6 +32,7 @@ import {_UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS} from "./provi
3132
* Any routed components are added as `entryComponents:` so they will get compiled.
3233
*/
3334
@NgModule({
35+
imports: [CommonModule],
3436
declarations: [_UIROUTER_DIRECTIVES],
3537
exports: [_UIROUTER_DIRECTIVES],
3638
entryComponents: [UIView],
@@ -219,4 +221,3 @@ export const UIROUTER_ROOT_MODULE = new OpaqueToken("UIRouter Root Module");
219221

220222
/** @hidden */
221223
export const UIROUTER_MODULE_TOKEN = new OpaqueToken("UIRouter Module");
222-

0 commit comments

Comments
 (0)