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


TypeScript Location.go方法代码示例

本文整理汇总了TypeScript中@angular/common.Location.go方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Location.go方法的具体用法?TypeScript Location.go怎么用?TypeScript Location.go使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/common.Location的用法示例。


在下文中一共展示了Location.go方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: if

            .subscribe(currentMail => {
                if ( !currentMail )
                {
                    // Set the current mail id to null to deselect the current mail
                    this.currentMail = null;

                    // Handle the location changes
                    const labelHandle  = this._activatedRoute.snapshot.params.labelHandle,
                          filterHandle = this._activatedRoute.snapshot.params.filterHandle,
                          folderHandle = this._activatedRoute.snapshot.params.folderHandle;

                    if ( labelHandle )
                    {
                        this._location.go('apps/mail/label/' + labelHandle);
                    }
                    else if ( filterHandle )
                    {
                        this._location.go('apps/mail/filter/' + filterHandle);
                    }
                    else
                    {
                        this._location.go('apps/mail/' + folderHandle);
                    }
                }
                else
                {
                    this.currentMail = currentMail;
                }
            });
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:29,代码来源:mail-list.component.ts

示例2: if

            .subscribe(currentTodo => {
                if ( !currentTodo )
                {
                    // Set the current todo id to null to deselect the current todo
                    this.currentTodo = null;

                    // Handle the location changes
                    const tagHandle    = this._activatedRoute.snapshot.params.tagHandle,
                          filterHandle = this._activatedRoute.snapshot.params.filterHandle;

                    if ( tagHandle )
                    {
                        this._location.go('apps/todo/tag/' + tagHandle);
                    }
                    else if ( filterHandle )
                    {
                        this._location.go('apps/todo/filter/' + filterHandle);
                    }
                    else
                    {
                        this._location.go('apps/todo/all');
                    }
                }
                else
                {
                    this.currentTodo = currentTodo;
                }
            });
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:28,代码来源:todo-list.component.ts

示例3: it

    it('should work after using back button', inject([Location], (location: Location) => {

         expect(location.getState()).toBe(null);

         location.go('/test1', '', {url: 'test1'});
         location.go('/test2', '', {url: 'test2'});

         expect(location.getState()).toEqual({url: 'test2'});

         location.back();

         expect(location.getState()).toEqual({url: 'test1'});
       }));
开发者ID:marclaval,项目名称:angular,代码行数:13,代码来源:location_spec.ts

示例4: it

    it('should incorporate the provided query values into the location change', () => {
      var locationStrategy = new MockLocationStrategy();
      var location = new Location(locationStrategy);

      location.go('/home', "key=value");
      expect(location.path()).toEqual("/home?key=value");
    });
开发者ID:Coco-wan,项目名称:angular,代码行数:7,代码来源:location_spec.ts

示例5: readMail

    // -----------------------------------------------------------------------------------------------------
    // @ Public methods
    // -----------------------------------------------------------------------------------------------------

    /**
     * Read mail
     *
     * @param mailId
     */
    readMail(mailId): void
    {
        const labelHandle  = this._activatedRoute.snapshot.params.labelHandle,
              filterHandle = this._activatedRoute.snapshot.params.filterHandle,
              folderHandle = this._activatedRoute.snapshot.params.folderHandle;

        if ( labelHandle )
        {
            this._location.go('apps/mail/label/' + labelHandle + '/' + mailId);
        }
        else if ( filterHandle )
        {
            this._location.go('apps/mail/filter/' + filterHandle + '/' + mailId);
        }
        else
        {
            this._location.go('apps/mail/' + folderHandle + '/' + mailId);
        }

        // Set current mail
        this._mailService.setCurrentMail(mailId);
    }
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:31,代码来源:mail-list.component.ts

示例6:

            .then(() => {

                // Trigger the subscription with new data
                this._ecommerceProductService.onProductChanged.next(data);

                // Show the success message
                this._matSnackBar.open('Product added', 'OK', {
                    verticalPosition: 'top',
                    duration        : 2000
                });

                // Change the location with new one
                this._location.go('apps/e-commerce/products/' + this.product.id + '/' + this.product.handle);
            });
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:14,代码来源:product.component.ts

示例7: setCurrentTodo

    /**
     * Set current todo by id
     *
     * @param id
     */
    setCurrentTodo(id): void
    {
        this.currentTodo = this.todos.find(todo => {
            return todo.id === id;
        });

        this.onCurrentTodoChanged.next([this.currentTodo, 'edit']);

        const tagHandle    = this.routeParams.tagHandle,
              filterHandle = this.routeParams.filterHandle;

        if ( tagHandle )
        {
            this._location.go('apps/todo/tag/' + tagHandle + '/' + id);
        }
        else if ( filterHandle )
        {
            this._location.go('apps/todo/filter/' + filterHandle + '/' + id);
        }
        else
        {
            this._location.go('apps/todo/all/' + id);
        }
    }
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:29,代码来源:todo.service.ts

示例8: navigate

	// ---
	// PUBLIC METHODS.
	// ---

	// I navigate to the given URL. This URL is expected to be a "complete" URL; meaning,
	// it contains all the necessary components: pathname, query-string, and hash.
	public navigate( newPath: string ) : void {

		// In the documentation, the .go() method accepts two arguments: "path" and 
		// "query". This leaves you wondering about the "hash" - where does that go? 
		// Well, it turns out that the path and query don't really need to be broken out
		// into separate components. Under the hood, they are just concatenated. As such,
		// we can include them in the "path" argument, along with any desired HASH value.
		this.location.go( newPath );

		// Since the PopStateEvent doesn't fire when we programmatically navigate, let's
		// turn around and query the location.
		console.group( "Internal Navigation" );
		console.log( this.location.path() );
		console.groupEnd();

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:22,代码来源:app.component.ts


注:本文中的@angular/common.Location.go方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。