router

“Exception: Error during instantiation of t! Primary outlet already registered.” in cordova angular2 app

南笙酒味 提交于 2019-11-30 13:53:41
I am building an simple cordova app with my project. It has 2 levels of nesting (main route) -> child route -> (another child route). When trying to browse to the 2nd level (another child route) I get an error saying Exception: Error during instantiation of t! Primary outlet already registered. First level works fine. I have not used router outlet twice in any template. The issue is the same in the emulation of browser as well as android. Attached the chrome inspect below. My HTML File <html> <head> <base href="./"> <meta http-equiv="Content-Security-Policy" content="default-src 'self' data:

Is there a way to catch all non-matched routes with Backbone?

天大地大妈咪最大 提交于 2019-11-30 11:46:40
问题 I want to have a 'catch all' route which runs when none of the other defined routes are matched. A type of 404 NotFound error handler. I've tried adding this, which works but prevents other routes from matching: this.route(/(.*)/, 'notFound', this.notFound); Anyone solved this problem before? 回答1: Answering here for completeness. You can do this 2 ways. Define the regular expression using route() , as in the question. However, due to this bug you would need to define all your routes via the

Best way to do dynamic routing with Express.js (node.js)

亡梦爱人 提交于 2019-11-30 11:39:07
问题 I'm trying to create a simple CMS with express.js that dynamically creates routes. It gets a JSON from a database that looks like this: pagesfromdb = { home = { paths = ['/','/home','/koti'], render = 'home.ejs', fi_FI = {html='<h1>Hei maailma!</h1>'}, en_US = {html='<h1>Hello World!</h1>'} }, about = { paths = ['/about','/tietoja'], render = 'general.ejs', fi_FI = {html='Tietoja'}, en_US = {html='About Us'} } } and iterates over the objects creating routes like so: Object.keys(pagesfromdb)

Pass invisible or hidden parameters using routerLink Angular

与世无争的帅哥 提交于 2019-11-30 08:24:49
I have router link like below: <button class="take-a-tour-btn" [routerLink]="['/dashboard', {'showTour':'show'}]"> I want to pass parameter showTour . But, when I do this, the parameter is visible in url and I would like to hide it. I have gone through so many references(which says about optional parameters) ,but with no success in my case. How could I solve this? I'm not sure, if there is a way to do it, because the data need to be presented in the URL string. My suggestion is using global service which be store needed data. For example: //some dataService, which store your needed data.

How to know ip address of the router from code in android?

*爱你&永不变心* 提交于 2019-11-30 07:50:35
How can you find the IP address of the router (gateway address) from code? WifiInfo.getIpAddress() - returns IP address of device. In a shell command "ipconfig" does not return any value. Here is my solution, but please let me know if there is a better way to do this: WifiManager manager = (WifiManager)getSystemService(WIFI_SERVICE); DhcpInfo info = manager.getDhcpInfo(); info.gateway; Hey this might help you: DHCPInfo final WifiManager manager = (WifiManager) super.getSystemService(WIFI_SERVICE); final DhcpInfo dhcp = manager.getDhcpInfo(); final String address = Formatter.formatIpAddress

Property 'url' does not exist on type 'Event' for Angular2 NavigationEnd Event

南笙酒味 提交于 2019-11-30 05:17:23
问题 this.subscription = this.router.events.subscribe((event:Event) => { console.log(event.url); ##### Error : Property 'url' does not exist on type 'Event'. } Typescript doesn't recognize the properties of the type Event that is built into the Angular Router. Is there something on tsd that I can use to solve this? Event is the super class of classes NaviagationEnd, NavigationStart 回答1: You have to import { Event } from @angular/router; . Try moving console into the if block with condition. this

Best way to do dynamic routing with Express.js (node.js)

你离开我真会死。 提交于 2019-11-30 01:21:30
I'm trying to create a simple CMS with express.js that dynamically creates routes. It gets a JSON from a database that looks like this: pagesfromdb = { home = { paths = ['/','/home','/koti'], render = 'home.ejs', fi_FI = {html='<h1>Hei maailma!</h1>'}, en_US = {html='<h1>Hello World!</h1>'} }, about = { paths = ['/about','/tietoja'], render = 'general.ejs', fi_FI = {html='Tietoja'}, en_US = {html='About Us'} } } and iterates over the objects creating routes like so: Object.keys(pagesfromdb).forEach(function(key) { var page = pagesfromdb[key]; app.get(page.global.paths,function(req, res){ res

Multiple routers vs single router in BackboneJs

一个人想着一个人 提交于 2019-11-29 20:20:34
All examples on Backbone I've seen use one router for the whole application, but wouldn't it make sense to have a router for each single part of your app (header, footer, stage, sidebar)? Has anyone built apps with more than one router and what are your experiences? Let's think about a complex app with nested views: Wouldn't it be better when a view has its own router that handles the display of the subviews, than having one big router that has to inform the main view to change its subviews? The background of this question: I've see a lot of parallels of the router in backbone and the

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

此生再无相见时 提交于 2019-11-29 15:24:22
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 } from '@angular/router'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '

Bookmarklet: Append hidden iframe to page and load url

时间秒杀一切 提交于 2019-11-29 14:18:13
问题 I have a bookmarklet for resetting my router. I just need to visit and let the page finish loading, then my router starts resetting. javascript:(function(){w=window.open("http://192.168.0.1/goform/formReboot","","width=1,height=1");self.focus();window.onload=w.close();})(); But it opens in a popup window. My new idea is to dynamically append an hidden iframe to the page I'm on using a javascript bookmaklet, and then open the url in the hidden iframe. Is this even possible? I'm open for better