本文整理匯總了TypeScript中ui-router-ng2.trace.enable方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript trace.enable方法的具體用法?TypeScript trace.enable怎麽用?TypeScript trace.enable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ui-router-ng2.trace
的用法示例。
在下文中一共展示了trace.enable方法的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})
]);