Incorporating Bower or NPM Component into an Angular 2/4 cli Project

I am in the process of setting up a basic Angular 4 project with the CLI and I would like to integrate a package from either NPM or Bower into it. The specific package I am interested in is Multi Step Form (https://github.com/troch/angular-multi-step-form). I understand that I need to include it in the @NgModule class (previously known as angular.module), however, despite multiple attempts, Angular seems to have trouble recognizing the module when using Bower, and I keep encountering an error message

Can't resolve 'angular' in [path-to-multi-step-form/dist/commonjs]

Below is the code snippet for app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

and here's the app.component.ts file:

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

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'app';
}

Could someone please guide me on how to properly incorporate components into Angular 2/4 CLI projects? I am getting frustrated with this issue even though I have been working with Angular for quite some time now... :/

Answer №1

It's important to thoroughly review the documentation of the Module you are attempting to include.

The requirement is listed as 1.3 and above Access link here

Your goal is to integrate an AngularJS Module into Angular.

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

Is there a way to define a return type conditionally depending on an input parameter in typing?

I need help ensuring that a function in TypeScript returns a specific type based on a parameter. How can I make TypeScript understand my intention in this scenario? type X = 'x' type Y = 'y' const customFunc = <Type extends X | Y> ...

Encountering an EPERM error during npm install for React Native, specifically when attempting to unlink files due to operation not permitted

Just a couple of hours ago, I stumbled upon react native and decided to give it a shot. Excited, I opened my console and entered 'npm install create-react-native-app -g' for the installation process. After that was successful, I proceeded to crea ...

Is there a disparity in capabilities or drawbacks between ViewChild and Input/Output in Angular?

As I delve into Angular ViewChild and compare it to Input/Output parameters, I can't help but wonder if ViewChild has any drawbacks or limitations compared to Input/Output. It appears that ViewChild is the preferred method, as all parameters are now ...

Master the art of iterating through an Object in TypeScript

I need help with looping through an Object in TypeScript. While the following examples work in JavaScript, I understand why they pose a problem in TypeScript. Unfortunately, I am struggling to find the correct approach to solve this issue. Am I approaching ...

When selecting a dropdown in Angular 5, the aria-expanded attribute remains unchanged and the 'show' class is not applied. This behavior is specific to Bootstrap dropdowns

Having an issue with the bootstrap dropdown in my Angular project. When I click on it, the dropdown-menu does not show up. The 'show' class is not being added to the dropdown and the 'aria-expanded="false"' attribute does not change to ...

Leveraging sha1 and md5 for ensuring the integrity of packages within the yarn.lock file

Given that md2, md5, sha1 hashing mechanisms are no longer recommended for iOS 13 due to security concerns. Why do we still find them in the integrity of dependencies listed in the yarn.lock file? "@types/redux-thunk@^2.1.0": version "2.1 ...

Tips for enabling hot reloading while using "webpack serve" with Webpack 5

After upgrading to Webpack 5, I ran into an issue where webpack-dev-server stopped working. To address this, I modified my npm start command from using webpack-dev-server to webpack serve. Here is my updated npm start command: webpack serve --config ./bu ...

The ng generate component command is only failing in one specific module due to an error that says "Cannot read property '0' of null"

Attempting to create a fresh component within one of my modules. After navigating to [project]/src/app, I type in the following command: ng g c admin/list where admin represents an existing module and list is the desired name for the new component. The ...

Having trouble with npm start causing webpack issues?

I have a small React mini app that I am trying to start with the command npm start - package.json - "scripts": { "start": "node server.js" Everything works fine on Windows, but when I try to start it on Ubuntu, the console throws an error. /var/www/r ...

What could be causing the file resumeData.json to not load correctly on GitHub pages after deployment?

After trying out this specific tutorial for deploying my personal website template found on GitHub to GitHub pages, I encountered an issue with the loading of information from public/resumeData.json. My personal page can be accessed at: The master branch ...

Unusual error encountered in @vue-cli 3 involving package dependency @vue/eslint-config-standard@^3.0.1

Just recently upgraded to the latest version of @vue-cli and ran into an issue. When trying to run npm install, I encountered the following error: npm ERR! code ETARGET npm ERR! notarget No matching version found for @vue/eslint-config-standard@^3.0.1 npm ...

What is preventing the mat-slide-toggle from being moved inside the form tags?

I've got a functioning slide toggle that works perfectly, except when I try to move it next to the form, it stops working. When placed within the form tag, the toggle fails to change on click and remains in a false state. I've checked out other ...

The custom native date adapter is facing compatibility issues following the upgrade of Angular/Material from version 5 to 6

In my Angular 5 application, I had implemented a custom date adapter as follows: import {NativeDateAdapter} from "@angular/material"; import {Injectable} from "@angular/core"; @Injectable() export class CustomDateAdapter extends NativeDateAdapter { ...

A versatile tool for creating customizable components on the fly

I am looking to create a function within my service that generates dynamic components into a ViewChild reference... I attempted to do this by: public GenerateDynamicComponent(ComponentName: string, viewContainerRef: ViewContainerRef, data?: any) { sw ...

Factors impacting performance in ngUpgrade

I am currently exploring the possibility of transitioning our Angular 1 application to Angular 2. We have accumulated a substantial amount of code that makes using ng-upgrade a more practical option than starting from scratch. Our current application is b ...

Saving large amounts of data in bulk to PostgreSQL using TypeORM

I am looking to perform a bulk insert/update using TypeORM The Test entity is defined below: export class Test { @PrimaryColumn('integer') id: number; @Column('varchar', { length: 255 }) testName: string; } I have the f ...

Tips for incorporating conditional types into function parameters based on existing input

The title might be confusing, so allow me to clarify. My Objective I am referring to the code snippet below. I aim to specify the route property based on the types property as either a string or a function that returns a string. The Code Let's b ...

Having trouble executing $(git rev-parse --short HEAD) in the package.json file on Virtualbox

In my package.json file, I have the following script: "scripts": { "docker-build": "docker build -t url.com/repository:$(git rev-parse --short HEAD) ." } This script is used to automatically tag my Docker images based on Git commits. It works fine on ...

Facing compilation issues when using Typescript with Svelte

My project was set up using npm create svelte@latest, with ts enabled and tailwind added. However, when declaring <script lang="ts">, I encountered an Unexpected Token error, like the one below: D:/gits/rpg-board/src/lib/components/FilterB ...

Angular 10 and Typescript: Variables assigned within the change event become undefined

In my code, I initialize an Algolia input and set an onchange event to it. This initialization takes place in a service. algolia_data; random_var; this.http.post<any>('APIENDPOINT', formData).subscribe(data => { instance = places({ ...