Comments (9)
@koodikindral Based on this log, it's you who should upgrade the angular version in you project. LocalizeRouter
uses angular version 2.2.0 and ng2-translate 4.0.0.
As you can see in package.json
:
"peerDependencies": {
"@angular/core": "^2.2.0",
"@angular/http": "^2.2.0",
"@angular/router": "^3.2.0",
"rxjs": "^5.0.0-beta.12",
"ng2-translate": "^4.0.0"
}
Please let me know if it's conflicting with ng2-select
that you're using. From what I see they have their version fixed to 2.0.0.
from localize-router.
@koodikindral Sometimes npm has issues with upgrading to latest versions so try one of these:
- run
npm install
until all UNMET PEER DEPENDENCY errors are gone or - manually delete conflicting package folders in node_modules and run
npm install
once
from localize-router.
Thanks, got it working!
Another question regarding the implementation: Is it possible to get it working also with angular-seed: https://github.com/mgechev/angular-seed
It has somewhat different routing (each component has it's own routing module).
from localize-router.
Hi, it's possible as long as it's not lazy loaded (see #3).
Angular-seed uses so called child routes. It's used similarly as RouterModule
in child modules:
LocalizeRouterModule.forChild(routes),
RouterModule.forChild(routes)
I will update documentation and example project as soon as possible.
from localize-router.
Seems better, but:
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home.component';
import { LocalizeRouterModule, LocalizeParser } from 'localize-router/localize-router';
const routes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'home', component: HomeComponent }
];
@NgModule({
imports: [
LocalizeRouterModule.forChild(routes),
RouterModule.forChild(routes)
],
exports: [LocalizeRouterModule, RouterModule]
})
export class HomeRoutingModule { }
->
zone.js?1479817675655:355 Unhandled Promise rejection: No provider for LocalizeParser! ; Zone: <root> ; Task: Promise.then ; Value: NoProviderError {_nativeError: Error: No provider for LocalizeParser!
at NoProviderError.BaseError [as constructor] (http://loc…, keys: Array[1], injectors: Array[1]}
from localize-router.
Can you check in full log in which exact file does this happen or provide a plunkr example?
You can check https://github.com/meeroslav/localize-router-example for working example built with CLI.
What I can see from your code insert is that you've imported LocalizeParser
but never used it. However, this can throw only tslint error (depending on lint config), not a runtime one.
This error looks like you tried to initialise child routes before the parent routes, but it's hard to say without looking at the full code.
from localize-router.
Thanks, much better now! One small problem though, when I open the app from root URL, home page won't be shown (added to the router-outlet), but when I open the page from http://localhost:5555/en for example, it's working as intended.
home-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home.component';
import { LocalizeRouterModule } from 'localize-router/localize-router';
let routes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'home', component: HomeComponent }
];
@NgModule({
imports: [
LocalizeRouterModule.forChild(routes),
RouterModule.forChild(routes)
],
exports: [LocalizeRouterModule, RouterModule]
})
export class HomeRoutingModule { }
app-routing-module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LocalizeRouterModule } from 'localize-router/localize-router';
let routes: Routes = [{ path: '', redirectTo: 'home', pathMatch: 'full' }];
@NgModule({
imports: [
LocalizeRouterModule.forRoot(routes),
RouterModule.forRoot(routes)
],
exports: [LocalizeRouterModule, RouterModule]
})
export class AppRoutingModule { }
from localize-router.
Found the problem:
localize.changeLanguage('ee');
was called on app.component.ts's constructor :) Issue can be closed, thanks for the great package :)
from localize-router.
Glad to hear that. Thank you for your feedback!
from localize-router.
Related Issues (20)
- localize-router not working as expected with Angular Universal: server-side rendering HOT 6
- Function traverseSnapshot not properly assembling the new translated route. HOT 11
- Localize router unable to pass data params on an empty path HOT 2
- Out of sync localize pipe HOT 1
- changeLanguage does not work for route with parameters HOT 6
- After language is switch, back button redirect into 404
- InitialNavigation enabled crashes Routing HOT 7
- Lazy loaded component is not bootstrapping HOT 4
- can't trigger window.load
- Angular 8 + IVy support HOT 1
- Can't make it, need tutorial. HOT 1
- Angular recognize only the default lang in SSR. HOT 4
- Angular 8 support HOT 6
- Extra slash translating root route
- LazyLoad Child Componenter onPage Refresh re-directs:Home Page HOT 1
- Unhandled promise rejection HOT 6
- Custom Cookies expiration
- Children routes issue lazy load module HOT 5
- Problem with Initial Navigation in RouterModule HOT 4
- LocalizeRouterModule.forRoot returns a ModuleWithProviders type without a generic type argument HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localize-router.