本文整理汇总了TypeScript中@ngrx/router.provideRouter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript provideRouter函数的具体用法?TypeScript provideRouter怎么用?TypeScript provideRouter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了provideRouter函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
export default function (params: aspnet.BootFuncParams): Promise<{ html: string, globals?: any }> {
const serverBindings = [
ngCore.provide(BASE_URL, { useValue: '/' }),
ngCore.provide(ORIGIN_URL, { useValue: params.origin }),
ngCore.provide(REQUEST_URL, { useValue: params.url }),
...ngUniversal.NODE_PLATFORM_PIPES,
...ngUniversal.NODE_ROUTER_PROVIDERS,
...ngUniversal.NODE_HTTP_PROVIDERS,
...provideRouter(routes)
];
let boot = ngUniversal.bootloader({
directives: [App],
componentProviders: serverBindings,
async: true,
preboot: false,
// TODO: Render just the <app> component instead of wrapping it inside an extra HTML document
// Waiting on https://github.com/angular/universal/issues/347
template: '<!DOCTYPE html>\n<html><head></head><body><app></app></body></html>'
})
return boot.serializeApplication().then(html => {
boot.dispose();
return { html };
});
}
开发者ID:laskoviymishka,项目名称:Unicorn.Cms,代码行数:26,代码来源:boot-server.ts
示例2: main
export function main(initialHmrState?: any): Promise<any> {
return bootstrap(App, [
...PROVIDERS,
...ENV_PROVIDERS,
...DIRECTIVES,
...PIPES,
...APP_PROVIDERS,
provideRouter(routes, PathLocationStrategy)
])
.catch(err => console.error(err));
}
开发者ID:MichaelFrohberg,项目名称:michaelfrohberg.github.io,代码行数:13,代码来源:main.browser.ts
示例3: main
export function main(): Promise<any> {
return bootstrap(App, [
...PROVIDERS,
...ENV_PROVIDERS,
...DIRECTIVES,
...PIPES,
...AUTH_PROVIDERS,
provideRouter(routes),
AuthGuard
])
.catch(err => console.error(err));
}
开发者ID:danielsuter,项目名称:ng2-camp,代码行数:14,代码来源:main.browser.ts
示例4: main
export function main(initialHmrState?: any): Promise<any> {
return bootstrap(App, [
...HTTP_PROVIDERS,
...ENV_PROVIDERS,
...PROVIDERS,
...DIRECTIVES,
...PIPES,
...APP_PROVIDERS,
provideStore(todos,initialState),
provideRouter(routes),
installSagaMiddleware(...my_sagas)
])
.catch(err => console.error(err));
}
开发者ID:JamesUlph,项目名称:ng2-start,代码行数:17,代码来源:main.browser.ts
示例5: bootstrap
import {bootstrap} from '@angular/platform-browser-dynamic'
import { provideRouter, Routes } from '@ngrx/router';
import { LocationStrategy,HashLocationStrategy } from '@angular/common';
import { provide } from '@angular/core';
import {provideStore} from '@ngrx/store';
import {AppComponent} from './components/app.component'
import {HelpComponent} from './components/help/help.component'
import {AboutComponent} from './components/about/about.component'
import {CounterComponent} from './components/counter/counter.component.ts'
import {counter} from './reducers/counter';
const routes: Routes = [
{ path: '/', component: AboutComponent },
{ path: '/about', component: AboutComponent },
{ path: '/help', component: HelpComponent },
{ path: '/cnt', component:CounterComponent}
]
bootstrap(AppComponent, [
provideRouter(routes),
provide(LocationStrategy, { useClass: HashLocationStrategy }),
provideStore({ counter }, { counter: 0 })
]);
// bootstrap(AppComponent, [
// provideRouter(routes)
// ]);
开发者ID:mckennatim,项目名称:ng2-ts-webpack,代码行数:30,代码来源:boot.ts
示例6: runEffects
* with output of relevant (registered as effects) actions being
* dispatched into your application store. Any side-effects in
* your application should be registered as effects.
*
* Source: https://github.com/ngrx/effects/blob/master/lib/run-effects.ts#L8-L20
*/
runEffects(effects),
/**
* provideRouter sets up all of the providers for @ngrx/router. It accepts
* an array of routes and a location strategy. By default, it will use
* `PathLocationStrategy`.
*
* Source: https://github.com/ngrx/router/blob/master/lib/index.ts#L44-L51
*/
provideRouter(routes, HashLocationStrategy),
/**
* connectRouterToStore configures additional providers that synchronize
* router state with @ngrx/store. This lets you debug router state using
* ngrx/store and to change the location by dispatching actions.
*/
connectRouterToStore(),
/**
* provideDB sets up @ngrx/db with the provided schema and makes the Database
* service everywhere.
*/
provideDB(schema),
/**
开发者ID:bkinsey808,项目名称:ngrx-graphql-experiment,代码行数:31,代码来源:main.browser.ts
示例7: bootstrap
// Import the core angular services.
import { bootstrap } from "@angular/platform-browser-dynamic";
// Import the application components and services.
import { AppComponent } from "./app_component";
import {provideRouter} from '@ngrx/router';
import {routes} from './routes';
bootstrap( AppComponent , [provideRouter(routes)]);
开发者ID:tiagoroldao,项目名称:angular2-tests,代码行数:10,代码来源:main.ts
示例8: bootstrap
import {bootstrap} from '@angular/platform-browser-dynamic';
import {HTTP_PROVIDERS} from '@angular/http';
import {provideRouter} from '@ngrx/router';
import {provideStore} from '@ngrx/store';
import {AppComponent} from './app.component';
import {routesConfig} from './routes.config';
import {ApiService} from './common/api.service';
import {locations} from './common/reducers/locations';
import {issues} from './common/reducers/issues';
import {customers} from './common/reducers/customers';
bootstrap(AppComponent, [
HTTP_PROVIDERS,
ApiService,
provideStore({locations, issues, customers}),
provideRouter(routesConfig)
]);
开发者ID:flauc,项目名称:udacityCorporateDashboard,代码行数:17,代码来源:main.ts
示例9: bootstrap
import 'zone.js/dist/zone';
import 'reflect-metadata';
import { enableProdMode } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { provideRouter, HashLocationStrategy, PathLocationStrategy } from '@ngrx/router';
import { AppComponent, routes } from './app/app.component';
import { Store } from './store/store';
// if (process && process.env.ENV === 'production') {
// enableProdMode();
// }
bootstrap(AppComponent, [
// provideRouter(routes, HashLocationStrategy),
provideRouter(routes, PathLocationStrategy),
Store,
disableDeprecatedForms(),
provideForms()
]);
开发者ID:ovrmrw,项目名称:jspm-angular2-sample,代码行数:23,代码来源:boot.ts
示例10: bootstrap
// Import the application routes.
import { appRoutes } from "./app.routes";
import { AutofocusDirective } from "~/shared/directives/index";
import { LoadingIndicatorComponent } from "~/shared/directives/index";
import { ShowBlockDirective } from "~/shared/directives/index";
bootstrap(
AppComponent,
[
// Make the router directives available to the entire application.
// {
// provide: PLATFORM_DIRECTIVES,
// useValue: ROUTER_DIRECTIVES,
// multi: true
// },
provideRouter( appRoutes ),
// By default, the ngRx Router uses the PathLocationStrategy which uses the HTML5
// history.pushState() to change the URL without going back to the browser. This
// strategy requires that the server knows how to handle these URLs when / if the
// browser is refreshed or deep-linked. Since I am running this demo in GitHub
// on gh-pages, there is no server-side rendering. As such, I have to use the
// HashLocationStrategy, which puts the active URL behind the /#/. Otherwise, the
// demo would only work on the first load and break on most browser refreshes.
{
provide: LocationStrategy,
useClass: HashLocationStrategy
},
// Add some globally-available directives.
{
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:31,代码来源:main.ts
注:本文中的@ngrx/router.provideRouter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论