当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ui-router-ng2.trace类代码示例

本文整理汇总了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);
    }
开发者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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。