Occasionally the CUSTOM_ELEMENTS_SCHEMA error may appear intermittently

After updating from Angular 8 to Angular 9, I encountered an error when running the application:

error NG8002: Can't bind to 'text' since it isn't a known property of 'app-custom-message'.
    1. If 'app-custom-message' is an Angular component and it has 'text' input, then verify that 
it is part of this module.

This error was not present before the update.

The code in question is as follows:

Page.component.ts

<app-custom-message [icon]='"icon.png"' [text]="'the message'"><app-custom-message>
<app-custom-footer></app-custom-footer>

The error specifically occurs in the custom-message component. Even after removing the properties, the error persists. Strangely, the error does not appear in custom-footer.

Custom-Message.ts

import { Component, OnInit, Input } from '@angular/core';
@Component({
  selector: 'app-custom-message',
  templateUrl: './message.component.html',
  styleUrls: ['./message.component.scss']
})
export class MessageComponent implements OnInit {
  @Input() 'text';
  @Input() 'url' = null;
  @Input() 'icon' = null;
  closed = false;
  constructor() { }
  ngOnInit() {  }
}

I am using lazy loading, with the custom-message and custom-footer components located in a shared folder outside the pageModule domain. The file structure is as follows:

-PageFolder
--PageComponent
--PageModule
-Shared
--CustomMessage
--CustomFooter

While the application continues to work despite the error, it is a concern for me. I am aware that a solution would be to import the CUSTOM_ELEMENTS_SCHEMA in the PageModule, but this may mask potential errors in the future if a component name is used incorrectly.

Answer №1

Revise the @Input as follows:

@Input() content;
@Input() link = null;
@Input() image = null;

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

Hide the FormArray in a Reactive Form if it is not populated or cannot be determined

As a newcomer to Angular 4, I've embarked on my first project and started learning the ropes. I have devised a Reactive Form to showcase a form structure that looks like this: Form (FormGroup) | --> aggLevels (FormArray) | --> ...

Tips for decreasing the size of your Angular 7 production build

What are the best practices to minimize production build size? For production build, use the command ng build --prod To configure angular.json file, refer to the following links: https://i.stack.imgur.com/3LSxZ.jpg https://i.stack.imgur.com/yE0fL.jpg ...

Is there a way to efficiently compare multiple arrays in Typescript and Angular?

I am faced with a scenario where I have 4 separate arrays and need to identify if any item appears in more than two of the arrays. If this is the case, I must delete the duplicate items from all arrays except one based on a specific property. let arrayA = ...

Personalized path-finding tree iterator

I am trying to implement a custom iterator in JavaScript that can traverse a DOM tree based on specific criteria provided by a callback function. The goal is to return an array of the nodes that match the criteria as the generator iterates through the tree ...

Retrieve a user by their _id, remove a user using their _id, and modify a user based on their _id using Next.js 14, utilizing Typescript

I'm currently troubleshooting three request methods that are not functioning properly: GET, UPDATE, and DELETE for a user by _id. When I try to run these requests in the browser or postman, I receive a "no page found" error in the API call. The rout ...

Angular does not seem to be identifying the project name as a valid property

After installing Angular materials using the CLI, I decided to check my angular.json file and encountered an error in the console stating that "Property MEAN-APP is not allowed". [The name of my Angular project is MEAN-APP] Here's a screenshot of the ...

Ways to ascertain if a TypeScript type is a specific value

Can a utility type be created to identify whether a type is a literal value? For example: type IsLiteral<T> ... type IsStringALiteral = IsLiteral<string> // false type IsStringLiteralALiteral = IsLiteral<'abc'> // true type IsS ...

Preventing Event Propagation in Angular HTML

I am encountering an issue with stopPropagation, and I need assistance with implementing it in HTML and TypeScript for Angular. The problem is that the dialog opens but also triggers a propagation. Below is my code snippet in HTML: <label for="tab-two ...

What is the solution to the error message stating that the property 'pipe' is not found on the OperatorFunction type?

I implemented the code based on RxJS 6 documentation while working with angular 5, RxJS 6 and angularfire2 rc.10. However, I encountered the following error: [ts] property 'pipe' does not exist on type 'OperatorFunction<{}, [{}, user, str ...

Angular with NX has encountered a project extension that has an invalid name

I am currently using Angular in conjunction with nx. Whenever I attempt to execute the command nx serve todos, I encounter the following error: Project extension with invalid name found The project I am working on is named: todos. To create the todos app ...

Using parameters to create unions in TypeScript

Is there a standard method to parametrically define a union? I'm searching for a way to generically define something like: type U<K> = T<K1> | T<K2> | ... | T<Kn> // Where K === (K1 | ... | Kn) Note: I'm encountering a s ...

Is there a suitable alternative that supports TypeScript, particularly with Angular 6, as D3Js does not directly support TypeScript?

I am currently engaged in a new project focusing on HR Analytics, utilizing Python, R, MySQL, and Angular 6 for the front end user interface. In terms of Data Visualization, I am exploring the use of D3js. However, it is important to note that D3Js does no ...

VSCode displaying HTML errors within a .ts file

There is a strange issue with some of my .ts files showing errors that are typically found in HTML files. For example, I am seeing "Can't bind to 'ngClass' since it isn't a known property of 'div'" appearing over an import in ...

Effective ways to properly utilize the kendo-switch angular component for seamless rendering of the "checked" state

I recently started a new project in Angular 4 using CLI and incorporated various Kendo UI components. However, I encountered an issue with the kendo-switch component where it does not toggle correctly when set to checked=true. Instead of toggling from left ...

Securing Your Next.js Web App with Session Authentication

I have encountered a challenge while integrating NextAuth authentication into my React.js web application. To ensure seamless user authentication across the entire app, I am attempting to wrap a SessionProvider around the root component. However, VSCode ...

Angular6 dropdown menu malfunctioning---"The Angular6 dropdown menu is not functioning

I'm having an issue where clicking on a sidebar item does not open the menu as expected in my Angular 6 project. I'm unsure of how to troubleshoot and fix this problem. <li *ngIf="mUser.role.accountant !== true" class="nav-item dropdown" rout ...

What is the proper way to utilize a class with conditional export within the Angular app.module?

This query marks the initiation of the narrative for those seeking a deeper understanding. In an attempt to incorporate this class into app.module: import { Injectable } from '@angular/core'; import { KeycloakService } from 'keycloak-angul ...

Inquiring about Vue 3 with TypeScript and Enhancing Types for Compatibility with Plugins

I've been struggling to find a working example of how to implement type augmentation with Vue3 and TypeScript. I have searched for hours without success, trying to adapt the Vue2 documentation for Vue3. It appears that the Vue object in the vue-class ...

Tips for updating the styleurls link dynamically by clicking a button and maintaining the changes

In the midst of developing an angular 2 project, I am currently working on integrating theme settings. Within my project, I have crafted three distinct component.scss files: red.component.scss, yellow.component.scss, and blue.component.scss. My goal is t ...

Tips for retrieving additional values from a chosen variable in Angular 10

Here is an array I have: export const Glcode = [ { id: 1, Type: 'Asset', Name: 'Cash at Head Office', code: '10018' }, { id: 2, Type: 'Asset', Name: 'POS ACCOUNT ', code: '10432' }, { ...