Having trouble connecting 'chartData' to a 'div' in Angular 2 because it is not recognized as a valid property?

While working on my Angular project, I encountered the following error that I have been unable to resolve:

EXCEPTION: Uncaught (in promise): Error: Template parse errors: Can't bind to 'chartData' since it isn't a known property of 'div'.

EXCEPTION: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'chartData' since it isn't a known property of 'div'. ("<h1>Profile- {{name}} here</h1>
<div id="pie_chart",
    [ERROR ->][chartData]="pie_ChartData", 
    [chartOptions] = "pie_ChartOptions",
    chartType="PieChart",
"): ProfileComponent2@2:4

I would appreciate any suggestions on where I might be making a mistake.

profile.component.ts:

import { Component, OnInit,HostBinding,Input }         from '@angular/core';
import { Router,ActivatedRoute }                 from '@angular/router';
import { slideInDownAnimation }                  from '../../animations/animations'
import { GoogleChart}                             from'../../../../directives/angular2-google-chart.directive';

@Component({
    selector: 'profile-component2',
    directives: [GoogleChart],
    templateUrl:`../app/modules/dashboard/dashComponents/profileComponents/profile.component.html`,
    animations:[slideInDownAnimation]
})

export class ProfileComponent2 implements OnInit {

name="Shubham";
message: string;
@HostBinding('@routeAnimation') routeAnimation = true;
@HostBinding('style.display')   display = 'block';
@HostBinding('style.position')  position = 'absolute';
public login:{} = {};
private interval:any;
ngOnInit() {
      console.log("profile component2 initialized");
  }
       public pie_ChartData = [
                 ['Task', 'Hours per Day'],
                 ['Work',     11],
                 ['Eat',      2],
                 ['Commute',  2],
                 ['Watch TV', 2],
                 ['Sleep',    7] ];

       public pie_ChartOptions  = {
         title: 'My Daily Activities',
         width: 900,
         height: 500
       };  
}

profile.component.html:

<h1>Profile- {{name}} here</h1>
<div id="pie_chart",
    [chartData]="pie_ChartData", 
    [chartOptions] = "pie_ChartOptions",
    chartType="PieChart",
    GoogleChart>    </div> 

Answer №1

Ah, I see the solution.

Insert the following line into app.module.ts:

import {GoogleMap} from '../components/angular2-google-map.component';

@NgModule({
  imports: [ ],
  declarations: [GoogleMap]
})

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

Guide on integrating TLS into a specific context path within a Tomcat server

Is it possible to add TLS to a specific context path in a Tomcat server instead of applying it to a port? I have set up a Spring Boot gateway service and an Angular app on the same port within Tomcat, each with its own unique context path. I would like to ...

The Modal feature on cards consistently displays the initial object every time

When applying Bootstrap Modal to a list (Card-Columns) of Cards, the popup always loads the content of the 1st Card. Here is how my List Component looks like: <div class="card-columns" infiniteScroll [infiniteScrollDistance]="0.3" [in ...

Having trouble retrieving a specific key from the state object in Redux using TypeScript

I have incorporated TypeScript into my Ionic project, using React hooks. I recently added an errorReducer to handle any errors that may arise from the server. Below is a snippet of my code: Action import { ERROR_OCCURRED } from "./types"; ...

Adaptively linking to the property of a deeply nested object

Attempting to bind to a property of a nested object using [(ngModel)], but facing the challenge that the path to the property is dynamically set. Consider the following three classes: class A { p1: C constructor() { p1 = new C("A") } } class B { p2: ...

Provide a string argument when instantiating an abstract class

I am searching for a method to assign a name string within a class and utilize it in the abstract class at the constructor level, without the need for a function. Opening up the constructor is not an option due to using typedi. You can access the playgrou ...

Updating props in a recursive Vue 3 component proves to be a challenging task

I am facing an issue with two recursive components. The first component acts as a wrapper for the elements, while the second component represents the individual element. Wrapper Component <template> <div class="filter-tree"> &l ...

Error: Could not locate application for Ionic Serve command

I have been developing a project in Ionic2 on another computer. However, when I try to run ionic serve on my PC, an error message appears: 192.168.1.100:8100 Application not found I have configured my app to use a static IP address... How can I resolve ...

Reactive form allows you to easily format dates

Currently, the date displayed is 1/4/2022. We need it to display in the format 01/04/2022. Can we achieve this formatting using reactive forms with the sample Model form provided below? Thank you. How can we format it when starting from transactionStartD ...

Ways to simulate objects in jest

I'm facing an issue while trying to mock a function of an object using Jest and Typescript. Below is a concise version of my code: // myModule.ts export const Foo = { doSomething: () => { // ... does something console.log('original ...

Exploring Angular Testing: Unraveling Chained HTTP Requests with the Power of rxjs

I've been attempting to write unit tests for a function in my service that carries out a POST request followed by a GET request. I'm using switchMap to handle this, but running into an issue where the HttpTestingController match function isn&apos ...

Best practices for managing backend errors with Next.js 14

Currently, I am developing a project in Next.js 14 and I have set up my API requests using fetch within a handler.tsx file as shown below: async function getPositions() { const response = await fetch( process.env.BASE_API_URL + "/positions?enabl ...

Creating nested Array objects in a table format in Angular 2 without using a nested table and ensuring that columns remain aligned

I'm currently working on generating a table with nested Array objects. Unfortunately, using nested tables is causing alignment issues between the header of the outer table and the columns in the inner table. Here's an example of the classes I&ap ...

I'm encountering a typescript error as I migrate a Paho MQTT function from Angular 1 to Angular 2 - what could be causing this issue?

When connecting to my MQTT broker, I am working on several tasks. In my Ionic 2 and Angular 2 application, I have created an MQTT provider. Here is the provider code: import { Component } from '@angular/core'; import { NavController, ViewControl ...

Buffer Overflow - Security Audit - Node JS TypeScript Microservice Vulnerability Scan Report

Person Data Schema: import JoiBase from '@hapi/joi'; import JoiDate from '@hapi/joi-date'; const Joi = JoiBase.extend(JoiDate); const personDataSchema = Joi.object().keys({ person: Joi.object().keys({ personId: Joi.string().max( ...

Just incorporated Angular Material and Angular Animations into my project and encountered a slew of errors

After executing the command line: npm install --save @angular/material @angular/animations This snippet shows my package.json file: { "name": "cerpnew", "version": "0.0.0", "license": "MIT" ...

Establish a connection between two JSON files using the WordPress REST API

I have developed an app using ionic 2 that revolves around quotes. My goal is to manage these quotes (along with authors, categories, etc) using Wordpress and its REST API. Initially, I utilized normal posts for this purpose, but now I am exploring custom ...

Node_modules seem to be missing

After completing the TypeScript 101 QuickStart tutorial using Visual Studio 2015 and Node Tools for Visual Studio, I attempted to import the 'winston' npm module. However, no matter what path I specify, Visual Studio indicates that it cannot loca ...

Strict mode does not allow duplicate data properties in object literals within JavaScript

Challenge Description I am facing an issue with handling an optional variable called ByteRange. To accommodate this, I included 2 different URLs in the $resource. Upon doing so, I encountered the following error: Message: Error in parsing: "tools/tes ...

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 ...

Is there a way to insert a record upon the user clicking on the Add Record button?

// Here is my Component code // I want to figure out how to add a new row to the table with fresh values. import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-uom', templateUrl: './uom.component.html ...