Routing problem
XaBerr opened this issue · 3 comments
XaBerr commented
Hi,
I tried to do two test pages home
and config
but I can not connect with the router. The first home
page when I try to lands on config
I lands on completely blank page... as well not exist.
In web version all work well but not in electron!
I'm not sure if it is a bug or I miss something...
app.component.ts
import { Component } from '@angular/core';
import { RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprecated';
import { HomePageComponent } from './homepage.component';
import { HomeComponent } from './home.component';
import { ConfigComponent } from './config.component';
@Component({
selector: 'app',
templateUrl: './app/app.html',
directives: [ROUTER_DIRECTIVES],
})
@RouteConfig([
{path: 'home', component: HomeComponent, useAsDefault: true},
{path: 'config', component: ConfigComponent},
])
export class AppComponent { }
home.component.ts
import { Component } from '@angular/core';
import { NgIf } from '@angular/common';
import { ipcRenderer } from 'electron';
@Component({
selector: 'home',
templateUrl: 'app/home.html',
// styleUrls: [ 'app/home.min.css' ],
directives: [NgIf],
})
export class HomeComponent {
title = "Light Room"
configButton = "Configura"
}
config.component.ts
import { Component } from '@angular/core';
import { NgIf } from '@angular/common';
import { ipcRenderer } from 'electron';
import { Config } from "./db-classes";
@Component({
selector: 'config',
templateUrl: 'app/config.html',
directives: [NgIf],
})
export class ConfigComponent {
title = "Configurazione"
homeButton = "Esci"
saveButton = "Salva"
saveConfig = function(): void {
console.log("Salvo")
// ipcRenderer.sendSync('enter-key', "tutto Ok")
}
constructor() {
}
config: Config = {
key: "aaa",
path3DSMax: "",
pathDati: "",
flagProduction: false
}
}
home.pug
doctype html
h1 {{title}}
a(href='config').btn.btn-default {{configButton}}
therustmonk commented
I think It's necessary to update angular version and replace deprecated router to newest. It worked before, but last projects I use new router only. I'll update it when I'll have a chance.
XaBerr commented
I can do npm update --save
or there are something I need keep them in older versione?
XaBerr commented
Updated, now works!