本文整理汇总了TypeScript中ui-router-ng2.trace类的典型用法代码示例。如果您正苦于以下问题:TypeScript trace类的具体用法?TypeScript trace怎么用?TypeScript trace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了trace类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(router: UIRouter) {
if (DEBUG_INFO_ENABLED) {
trace.enable(Category.TRANSITION);
let vis = window['ui-router-visualizer'];
vis.visualizer(router);
}
router.urlRouterProvider.otherwise(function ($injector, $location) {
router.stateService.go('home');
return '/';
});
router.urlMatcherFactory.type('boolean', {
decode: function(val: string): boolean { return val === '1' || val === 'true'; },
encode: function(val: boolean) { return val ? '1' : '0'; },
equals: function(a, b) { return this.is(a) && a === b; },
is: function(val) { return [true, false].indexOf(val) >= 0; },
pattern: /0|1|true|false/
});
registerTransitionHooks(router.transitionService);
}
示例2: provide
import {trace, UIROUTER_PROVIDERS, UIView, UIRouterConfig, Category, UIROUTER_DIRECTIVES} from "ui-router-ng2";
import {MyUIRouterConfig} from "./router.config";
import {HTTP_PROVIDERS} from "@angular/http";
import {provide, PLATFORM_DIRECTIVES} from "@angular/core";
import {LocationStrategy, HashLocationStrategy, PathLocationStrategy, PlatformLocation} from "@angular/common";
import {bootstrap} from '@angular/platform-browser-dynamic';
import {BrowserPlatformLocation} from '@angular/platform-browser';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
// Enables tracing (check the console) of:
// - TRANSITION transition start, redirect, success, error, ignored
// - VIEWCONFIG ui-view component creation/destruction and viewconfig de/activation
trace.enable(Category.TRANSITION, Category.VIEWCONFIG);
bootstrap(UIView, [
// provide(LocationStrategy, { useClass: HashLocationStrategy }),
provide(LocationStrategy, { useClass: PathLocationStrategy }),
provide(PlatformLocation, { useClass: BrowserPlatformLocation }),
...UIROUTER_PROVIDERS,
...HTTP_PROVIDERS,
// Provide a custom UIRouterConfig to configure UI-Router
provide(UIRouterConfig, { useClass: MyUIRouterConfig }),
// Make `directives: [UIROUTER_DIRECTIVES]` optional in a @Component
// by always including them in the PLATFORM_DIRECTIVCES
provide(PLATFORM_DIRECTIVES, {useValue: [UIROUTER_DIRECTIVES], multi: true})
]);