當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript trace.enable方法代碼示例

本文整理匯總了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);
    }
開發者ID:JimSpriggs,項目名稱:sourdough,代碼行數:23,代碼來源:router.config.ts

示例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})
]);
開發者ID:shuangxia1,項目名稱:quickstart-ng2,代碼行數:30,代碼來源:bootstrap.ts


注:本文中的ui-router-ng2.trace.enable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。