angular-routing

how to navigate from sibling component to another sibling component in Angular?

别等时光非礼了梦想. 提交于 2021-01-28 00:24:31
问题 Below is my app.routing.ts export const Approute: Routes = [ { path: 'login', component: LoginComponent }, { path: 'home', component: HomeComponent, children: [ { path: 'dashboard', component: DashboardComponent }, { path: 'trip-details', component: TripDetailsComponent } ] }, { path: 'not-found', component : NotFoundComponent }, { path: '**', redirectTo: '/not-found' } ]; component.ts viewDetails(details) { ... this.route.navigate(['../trip-details']); } Above i have a component and am

$routeProvider not working with html5Mode

喜欢而已 提交于 2021-01-27 22:43:13
问题 I just start to learn angularJs, and was trying to configure the partial page with angular route service. It worked with the hash format, however,when I tried to get rid of hash, the routeProvider stopped working. JS app.config(function($routeProvider,$locationProvider){ $locationProvider.html5Mode(true); $routeProvider.when("/", { templateUrl: "/index.html" }). when("/about", { templateUrl: "/partials/about.html" }). when("/contact", { templateUrl: "/partials/contact.html" }). otherwise({

$routeProvider not working with html5Mode

自古美人都是妖i 提交于 2021-01-27 20:46:39
问题 I just start to learn angularJs, and was trying to configure the partial page with angular route service. It worked with the hash format, however,when I tried to get rid of hash, the routeProvider stopped working. JS app.config(function($routeProvider,$locationProvider){ $locationProvider.html5Mode(true); $routeProvider.when("/", { templateUrl: "/index.html" }). when("/about", { templateUrl: "/partials/about.html" }). when("/contact", { templateUrl: "/partials/contact.html" }). otherwise({

What is the best way to get current route params in Angular 6 services?

家住魔仙堡 提交于 2021-01-21 06:34:16
问题 I am trying to find out what is the best way to get the current route params in Angular 6. At the moment I have to pass the ActivatedRoute to the service's method as argument and then use it in the service. export class MainComponent { constructor(private dataService: DataService, private activeRoute: ActivatedRoute) { } getChartsData() { return this.dataService(this.activeRoute); } } @Injectable({ providedIn: "root" }) export class DataService { getChartsData(activatedRoute) { if

cannot find module in angular Lazy Loading

我与影子孤独终老i 提交于 2021-01-02 05:50:52
问题 I have an angular project successfully on the Mac environment Angular CLI: 7.0.5 Node: 8.11.3 OS: darwin x64 Angular: 7.0.3 Now I am running the same code on ubuntu 18.04 with the setup Angular CLI: 7.3.9 Node: 12.9.1 OS: linux x64 Angular: 7.2.15 however it is coming with a very weird issue when trying to lazy load another module, I keep getting this error Error: Cannot find module "app/website/site.module" Here is my project structure and app-routing.module.ts const routes: Routes = [ {

How to keep query parameters in angular 5 on all routes by default?

你。 提交于 2020-11-30 06:38:11
问题 Background: The user calls the app's url with the parameters and uses my app. While switching between different routes the url parameters should be kept visible in the browser's address bar. I have to keep the query parameters on each route of my app. That means if I have the url www.example.com/app/test?id=326748798342&state=1 and call a link with [routerLink]="['/login']" I have to get this url: www.example.com/app/login?id=326748798342&state=1 . On default I get the login route without the