Issue: Unable to resolve all parameters for setupRouter function

I encountered an error stating "Can't resolve all parameters for RouteParams" while setting up a basic app for routing.

Here is how my app.module.ts file is structured:

import { NgModule }       from '@angular/core';
import { BrowserModule }  from '@angular/platform-browser';
import { FormsModule }    from '@angular/forms';
import { HttpModule }    from '@angular/http';


import { App } from './app';
   import { routing } from './components/appRouting/app.routing';
   import { LoginComponent } from './components/login/loginComponent';
   import {SliderMenuComponent} from './components/sliderMenu/sliderMenuComponent';

      @NgModule({
       imports: [
         BrowserModule,
         FormsModule,
         routing,
         HttpModule
       ],
       declarations: [App,LoginComponent,SliderMenuComponent],
       providers: [],
       bootstrap: [App]
     })
     export class AppModule { }

This is the content of my app.routing.ts file:

import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {LoginComponent} from '../login/loginComponent';
import {SliderMenuComponent} from '../sliderMenu/sliderMenuComponent';
const appRoutes: Routes = [
  {
    path: '',
    redirectTo: '/login',
    pathMatch: 'full'
  },
  { path: 'login', component: LoginComponent },
  { path: 'slider', component: SliderMenuComponent }
    ];
export const appRoutingProviders: any[] = [
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);

As for my app.ts file, here is what it contains:

import {Component} from '@angular/core';

@Component({
   selector: 'app',
   template : `
   <h1 class="title">Component Router</h1>
   <nav>
     <a routerLink="/slider" routerLinkActive="active">Slider</a>
     <a routerLink="/login" routerLinkActive="active">Login</a>
    </nav>
    <router-outlet></router-outlet>
  `
})
export class App {
}

Answer №1

Just made the switch to "@angular/router": "3.0.0-rc.2" and everything is up and running smoothly now

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Incorporating a Symbol into a Function

Reviewing the following code snippet: namespace Add { type AddType = { (x: number, y: number): number; }; const add: AddType = (x: number, y: number) => { return x + y; }; } Can a 'unique symbol' be added to the AddType lik ...

Retrieving JSON parameters using $http.get in Angular from one URL and then from another source

As a newcomer to Angular, I am working on setting up basic UI components. I have successfully set up a RESTful Spring service and tested it using curl like this: curl http://myPersonalSite.com:1313/service/event?id=1 This command returns a JSON response ...

Creating a parameterized default route in Angular 2

These are the routes I've set up: import {RouteDefinition} from '@angular/router-deprecated'; import {HomeComponent} from './home/home.component'; import {TodolistComponent} from './todolist/todolist.component'; import { ...

Managing spinners in Protractor when they are concealed by a wrapper element

While writing a test for an Angular app using Protractor, I encountered several issues with handling spinners. I managed to solve some of them, but I'm unsure how to test spinners that are hidden by a wrapper. For instance, when the parent tag has ng- ...

What is the best way to create API documentation for my Angular projects in a way that produces offline-accessible HTML content?

Currently, I am working on a project that is based on AngularJS I am interested in incorporating source documentation similar to Java Docs into the project. While JSDOC and DGENI jsDOC seem to be popular options, they do not provide comprehensive support ...

Recent npm dependency error found in local development setup after functioning properly

Today, I have been diligently working on a local project and a local npm package that is being used in the project. Everything was running smoothly up until now - my project and the library were functioning without any issues when installed with npm instal ...

Exploring the capabilities of the hardware camera in Angular 2

Struggling to implement the tutorial in Angular2. The challenge lies in making navigator.mediaDevices.getUserMedia function properly. The error message indicates that mediaDevices is not recognized on type 'navigator'. Refer to the media capture ...

When utilizing <number | null> or <number | undefined> within computed() or signals(), it may not function properly if the value is 0

I've encountered an issue while implementing signals and computed in my new Angular project. There's a computed value that holds an id, which is initially not set and will be assigned by user interaction. To handle this initial state, I attempte ...

The ngFor directive seems to be malfunctioning on the HTML page as the data retrieved from the server is not

Currently, I am working with Angular 8 and facing an issue while trying to iterate data using *ngFor. It seems like the values are not being displayed in the view. Below is the code snippet that I'm working with: HTML <div *ngFor='let data ...

React Native: Once a user has successfully logged in, I would like the app to automatically direct them to the "Home" screen

After a user signs in, I would like my app to navigate home. However, it seems this is not working because the roots have not been updated. You can view the App code here to get a better understanding of what I am trying to communicate. What is the most e ...

How can Angular utilize dynamic InjectionTokens according to routes?

I am curious about the best way to initiate a service that relies on another service and a complex object used for creating a dependency within the service. Currently, I am utilizing an InjectionToken to inject the complex object into the service, but I re ...

By default, the HTML table will highlight the specific column based on the current month using either AngularJS or JavaScript upon loading

I am working with a table of 10 products and their monthly sales data. Using Angular JS, I am looking to highlight the entire column based on the current month and year. Additionally, we will also be incorporating future expected sales data into the table. ...

Encountering a permission issue while trying to execute npm install -g @angular/cli command

I recently started using Angular and am working on a new project. However, when I try to execute the following command: npm install -g @angular/cli I encounter the error message below: npm WARN checkPermissions Missing write access to /usr/local/lib/no ...

Adding ngrx action class to reducer registration

Looking to transition my ngrx actions from createAction to a class-based approach, but encountering an error in the declaration of the action within the associated reducer: export enum ActionTypes { LOAD_PRODUCTS_FROM_API = '[Products] Load Products ...

Encountered an error while trying to access an undefined property during an Angular Karma

I'm currently working on testing a service function that involves multiple $http.get() calls. The function being tested returns a promise but the test is failing with an error stating response is undefined. Below is the test script: it('should ...

Develop an Angular 6 application that utilizes an observable to monitor changes in a variable

I am working with Angular 6 and I need to monitor a variable for any changes and then stop or unsubscribe when the variable has a value. My initial thought was to use an Observable: myValue; // The variable that needs to be monitored myObservable = Obse ...

Angular Checkbox Click EventLearn how to handle click events on

How can I toggle the visibility of a form using ngIf when a click event is triggered by a checkbox? Below is the code for my column header and column values: <th><label class="btn btn-filter"> <input type="checkbox" ...

Personalized Angular dropdown menu

Recently, I've started delving into angularJS and I'm eager to create dropdowns and tabs using both bootstrap and angular. Although there is a comprehensive angular bootstrap library available, I prefer not to use it in order to gain a deeper und ...

Install a spring-boot and angular 7 application into tomcat 8.5 by deploying it as a war file

I have been working on deploying an Angular 7 + Spring Boot application as a war file to Tomcat. I followed the necessary steps to package the code into a war successfully, including the UI code. However, despite creating the war file with UI components, I ...

deleting the existing marker before placing a new marker on the Mapbox

Upon the map loading with GeoJson data, I have implemented code to display markers at specified locations. It works flawlessly, but I am seeking a way to remove previous markers when new ones are added. What adjustments should be made for this desired func ...