angular-routing

    0热度

    1回答

    我有一个头和页脚一个简单的主模板的应用程序,像这样 <section style="margin-bottom:70px"> <nav-menu></nav-menu> </section> <section> <router-outlet></router-outlet> </section> <section> <foot></foot> </secti

    0热度

    1回答

    我目前正在使用angular-cli项目。但是,在通过router.navigate导航组件加载组件后,运行组件构造函数时,ngOnInit和ngAfterViewInit挂钩不会激活。 我在这条路线是/login,我要前往/controlpanel 我读过https://github.com/angular/angular/issues/8012,但遗憾的是没有帮助,因为polyfills不影响

    0热度

    1回答

    如果我有绑定到特定路由的组件(假设OrdersListComponent绑定到/ orders /:userId)。 如果我理解正确,为了recive组件内的userId,我需要在构造函数中使用this.route.snapshot.params.userId。 当我想在另一个组件中使用这个组件时,这种情况会引起我的注意,在这种情况下,我将在@input()绑定中收回它。 有没有更好的方法来做到这

    1热度

    2回答

    我期待添加一个基地href到我的webapp。目前一切运行时正常运行: 本地主机:3000 /#/登录 但我需要添加基本href或 “充电” - >本地主机:3000 /充电/#/登录 当前的index.html <head> <base href="charge/" /> <meta charset="utf-8"> <meta name="description" content="">

    0热度

    1回答

    我有一个类似于http://example.com/login/?redirect="/user#account"的URL,因此我在此存储redirect值,并使用它在成功登录后导航到该页面。如果redirect查询中没有任何# (hash)值,那么这可以正常工作,但如果它具有该值然后将该值重定向到该路由,即使用户未登录,它也应该重定向到http://example.com/login/#/log

    1热度

    1回答

    在我的app.component.ts我有下面的代码来获取路由名称,但我总是得到/。有谁知道为什么?我期望得到例如home,contact。 import { Component } from '@angular/core'; import { Router } from '@angular/router'; @Component({ selector: 'app-root',

    0热度

    1回答

    我正在创建和角度4应用程序。恰巧我需要从我的URL中获取不同深度级别的参数,从而导致我不能获得参数。 假设我们有这样的URL: https://mysite/companies/:companyID/cups/:cupId/drawings/:drawId 通常,根据角文档,我们需要做的是这样的: ngOnInit() { this.activatedRoute.parent.parent.

    -1热度

    1回答

    这是我的配置: .state('index.oz', { abstract: true, url: '/oz', views: { '[email protected]': { templateUrl: "Views/oz/oz.html", controller: 'ozController' }

    0热度

    2回答

    我在路由上订阅的变化: public ngOnInit() { this.subscription = this.activateRoute.params.subscribe(params => { this.language = params['id']; }); console.log(this.language); } 但是当我通过点

    1热度

    2回答

    有谁知道我该如何测试Router NavigationEnd Event?我在Angular 2中使用了以下代码,并且使用了Jasmine。 import { Injectable, EventEmitter } from '@angular/core'; import { Router, NavigationEnd, Event } from '@angular/router'; @Inj