router

Angular2 2.0.0 Component Unit Test causes error: Bootstrap at least one component before injecting Router

余生颓废 提交于 2019-12-18 09:04:42
问题 Looking at previous similar questions, it doesn't seem that there was ever a clear answer for this. Here's what's happening. I'm building an angular2 app using the angular-cli tool (beta 16 running, with angular 2.0.1 and router 3.0.1. When I run "ng test" all my tests pass, expect my app.component. (ng serve is working fine etc) Here's some code: app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { Routes, RouterModule }

Does Ember routing fall back to using a hash if browser doesn't support the History API?

主宰稳场 提交于 2019-12-18 04:09:31
问题 Ember documentation states that it can be set to use the History API for routing rather than hash-based fragments by using: App.Router.reopen({ location: 'history' }); But I can find no mention of what will happen if a browser doesn't support the History API. Will it fall back to using a hash like History.js? If not, should I check for History API support and switch history implementation to hash if it isn't supported? 回答1: There doesn't seem to be any History API support detection in the

In Angular2 RC4 how do I add components to the precompile array?

≡放荡痞女 提交于 2019-12-18 01:57:07
问题 I just updated my Angular2 project to RC4 and the router is now sending out this warning message in the console when I open my application: router.umd.js:2466 'FrontpageComponent' not found in precompile array. To ensure all components referred to by the RouterConfig are compiled, you must add 'FrontpageComponent' to the 'precompile' array of your application component. This will be required in a future release of the router. I've tried to figure out what exactly I need to do to fix this but

Angular2 (rc4) - Check active child route in parent component

走远了吗. 提交于 2019-12-17 20:26:14
问题 I am trying to check the active child route in a parent component, but I am having difficulties with it. I have tried to subscribe to the ActivatedRoute by doing something like this: class ParentComponent { constructor(private _route:ActivatedRoute) {} ngOnInit() { this._route.data.subscribe(value => console.log(value)}); } } I have read a lot of threads on Stack Overflow, but can't find a solution that checks and gets updated regarding the child routes of a parent component. Any ideas? 回答1:

Domain name for my PC: how to (tried No-IP, DuckDNS and ngrok)

梦想的初衷 提交于 2019-12-17 16:54:31
问题 I want: ping server on my PC by it domain name from remote. I have: DynDNS services DuckDns (or No-IP, config in no-ip is even harder). It gets me an IP 94.154.220.216 and (sub)domain http://my_domain.duckdns.org . To configure DuckDNS on PC I need just specify some token and my domain name ( my_domain ). Also I've launched server on lacalhost:3000 . Also when I go to CanYouSeeMee it says that my IP is 94.154.220.216 (that's good). And I configured static IP for my PC (let's say 200.300.1.15

Changing the default name of “router-link-active” class by writing a custom directive that adds new class

你说的曾经没有我的故事 提交于 2019-12-17 16:40:36
问题 I would like to use Semantic UI in my Angular2 application. The problem is that I can't find a router setting that changes the default name of "router-link-active" class. I need it to be called just "active" to make menus display properly. As I understand, such setting doesn't exist. I've seen it in Vue.JS so I expect it to be there too. Is it a good idea to ask developers to fix this? So. We need to write a custom directive that adds "active" class to all DOM elements with "router-link

Loading External URL in Angular2 router-outlet

送分小仙女□ 提交于 2019-12-13 14:19:54
问题 I am developing an application using Angular2. I have a component with the following template: <div> <router-outlet></router-outlet> </div> Can someone please help me how to load an external URL 'www.example.com' in this div? 回答1: Just create a component to render inside <ng-outlet> by using the routing config. Then you component template inside should have an <iframe> pointing to your external site. import {Component, OnInit} from '@angular/core'; @Component({ selector: 'app-external-page',

Hot to generate the correct URL if hardcoded in Symfony project?

◇◆丶佛笑我妖孽 提交于 2019-12-13 09:25:22
问题 When I use the function {{ path('contact_route') }} and its equivalent in controller the generated URL is correct => http://localhost/myproject/web/app_dev.php/contact. But if I hardcode the URL (I am forced to do so in some particular cases), I get something unwanted, (a href="/contact") => http://localhost/contact 回答1: What you are "probably" asking is how to prepend the correct base URL to your manual built URL, i.e. something like this: a href="{{ app.request.baseUrl }}/contact" or if you

Multiple Shells (views and view models) and routers for different type of users in Durandal

扶醉桌前 提交于 2019-12-13 06:59:06
问题 So I'm trying to build an app that has two different kind of users, namely customers and sellers. The app is designed in such a way that both of them will have different kind of navigation bars and access to different kind of pages via routes. As such, I'm trying to see what is the best way to achieve this? I'm thinking of either of the following solutions: 1. using compose binding or areas in my shell.html and by having a container and based on a certain condition, the correct specific view

Cannot route to other pages in SPA angular with dynamic list

℡╲_俬逩灬. 提交于 2019-12-13 05:09:34
问题 I'm using single page application using angular 1.6. Whenever I use the static list to redirect the routes, it was working fine, but when trying with dynamic list from json, i couldn't get it. Here is the JSON: { "People": [{ "name": "Andrew Amernante", "rating": 3, }, { "name": "Frank Wang", "rating": 5, }, { "name": "Chang Wang", "rating": 5, } ] } In Controller, I have these code snippets. var app = angular.module('myApp', ['ngRoute']); app.config(['$locationProvider', function(