Angular2 Router error: cannot find primary outlet to load ‘HomePage’

Although @JS_astronauts already provided a solution, I think it would be instructive to explain the error… The primary outlet is set when Angular parses an HTML template and finds directive RouterOutlet, i.e., when it finds RouterOutlet’s selector: <router-outlet></router-outlet>. Although your template does contain <router-outlet></router-outlet>, your component does not contain directives: [ROUTER_DIRECTIVES], so Angular won’t look … Read more

Angular2 conditional routing

As mentioned, Angular Route Guards are a good way to implement conditional routes. Since the Angular Tutorial is a bit wordy on the topic, here is a short summary how to use them with an example. 1. There are several types of guards. If you need something of the logic if (loggedIn) {go to “/dashboard”} … Read more

Pass props from child to parent react navigation

There is really simple solution to pass back props to parent component on goBack(). You can pass an extra prop containing function to Modal and right before calling goBack() or in componentWillUnmount you can call that function. Example export default class SomeComp extends Component { … onGoBack = (someDataFromModal) => { console.log(someDataFromModal); } render() { … Read more

SSH -L connection successful, but localhost port forwarding not working “channel 3: open failed: connect failed: Connection refused”

ssh -v -L 8783:localhost:8783 [email protected] … channel 3: open failed: connect failed: Connection refused When you connect to port 8783 on your local system, that connection is tunneled through your ssh link to the ssh server on server.com. From there, the ssh server makes TCP connection to localhost port 8783 and relays data between the … Read more

RouterModule.forRoot(ROUTES) vs RouterModule.forChild(ROUTES)

I strongly suggest reading this article: Avoiding common confusions with modules in Angular Module with providers When you import a module you usually use a reference to the module class: @NgModule({ providers: [AService] }) export class A {} ———————————– @NgModule({ imports: [A] }) export class B In this way all providers registered on module A … Read more

How to separate routes on Node.js and Express 4?

Server.js var express = require(‘express’); var app = express(); app.use(express.static(‘public’)); //Routes app.use(require(‘./routes’)); //http://127.0.0.1:8000/ http://127.0.0.1:8000/about //app.use(“/user”,require(‘./routes’)); //http://127.0.0.1:8000/user http://127.0.0.1:8000/user/about var server = app.listen(8000, function () { var host = server.address().address var port = server.address().port console.log(“Example app listening at http://%s:%s”, host, port) }) routes.js var express = require(‘express’); var router = express.Router(); //Middle ware that is specific to … Read more

Providing input/subcommands to command executed over SSH with JSch

Calling ChannelExec.setCommand multiple times has no effect. And even if it had, I’d guess that the 192.168.50.1 : and Config.txt are not commands, but inputs to the copy run tftp : command, aren’t they? If that’s the case, you need to write them to the command input. Something like this: ChannelExec channel = (ChannelExec) session.openChannel(“exec”); … Read more