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

Is there a way to disable the entire formgroup upon creation using FormBuilder?

While using the FormBuilder, I encountered an interesting challenge. For instance: formName = this.fb.group({ inputName: ['default value', Validators.required], // many other items }); (Example taken from: https://stackblitz.co ...

Expanding MaterialUi styled components by incorporating TableCellProps: A guide

When trying to create a styled TableCell component in a separate file, I encountered an error in TypeScript (ts(2322)). TypeScript was indicating that the properties "component," "scope," and "colSpan" could not be used because they do not exist in StyledC ...

Monitor the status of your Angular CLI build with real-time notifications

Encountered an interesting issue while trying to integrate the 'webpack-notifier' plugin into a new Angular 7 application. The goal was to have balloon notifications for build failures when running 'ng build --watch' in the console. TL ...

Weighing the importance of a multiple-choice quiz

I am faced with the challenge of assessing 25 multiple choice questions, each offering 4 answer choices worth varying points. Additionally, I have 2 free response questions that I wish to score based on the time taken to answer them. My proposed scoring ru ...

Tips for simulating localStorage in TypeScript unit testing

Is there a method to simulate localStorage using Jest? Despite trying various solutions from this post, none have proven effective in TypeScript as I continue encountering: "ReferenceError: localStorage is not defined" I attempted creating my ...

Angular 2's .remove() method: removing elements like a pro

Consider a scenario where there is a list of 5 items, and the user should be able to delete a specific entry from that list. By using jQuery, you can target the delete button class and utilize 'this' to select its closest parent element, followed ...

What is the best way to incorporate a string value from an external file into a variable in TypeScript without compromising the integrity of special characters?

I am encountering an issue with importing a variable from a separate file .ts that contains special characters, such as accents used in languages like French and Spanish. The problem I am facing is that when I require the file, the special characters are ...

How can we efficiently load paginated data from a database while still implementing pagination using Angular Material?

I have a large table with more than 1000 entries that I want to display using a <mat-table></mat-table>. Since loading all the entries at once would be too much, I am looking to implement pagination and load only 20 entries per page. The chal ...

Issues with mat-tab-group not rendering properly after switching between parent tabs

I am facing an issue involving nested tabs and tables in my example. Check out the example here After switching between parent tabs and child tabs, there seems to be an issue where the tabs do not render properly. It takes multiple attempts of switching ...

Discovering the breakpoints for Angular ng-bootstrapUncover the angular ng

Utilizing ng-bootstrap in my latest project has allowed me to easily create a grid with breakpoints, like so: <div class="row"> <div class="col-sm-12 col-md-6 col-xl-4"></div> </div> Although these breakpoints are convenient, ...

Angular issue: Unable to implement Bootstrap dropdown in navbar

I've successfully added popper.js, bootstrap, and jquery to my project. Here is my Angular json file configuration: "styles": [ "src/styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css" ], "script ...

When utilizing gapi (typescript) to send emails, the Sent box may contain incorrectly encoded email messages

When I send emails using gapi, the receiver receives them correctly. However, when I check my "Sent" box, the emails appear as Chinese gibberish characters like in this image. This issue only occurs when using non-gmail applications. If I view the Sent bo ...

Utilize forRoot to pass configuration data

When using Angular, I encountered a challenge in passing configuration data to a custom library. Within the user's application, they are required to provide config data to my library through the forRoot method: // Importing the custom library import ...

Chrome autocomplete behaves as if the input fields are disabled and cannot be clicked on

I am experiencing an unusual issue with autofill in Chrome. After logging in and then logging out of the app, the input fields (email, password) are auto-filled but appear to be frozen and unclickable. This problem does not occur every time; it only happe ...

Utilize TypeScript enum keys to generate a new enum efficiently

I am in need of two Typescript enums as shown below: export enum OrientationAsNumber { PORTRAIT, SQUARE, LANDSCAPE } export enum OrientationAsString { PORTRAIT = 'portrait', SQUARE = 'square', LANDSCAPE = 'landscape&ap ...

Alert an Angular 2 component about changes triggered by a service

Currently working with Angular 2 and utilizing an AuthService for authentication. I am at a crossroads on how to effectively inform other components when a user logs in or out. Seeking advice on the best approach for managing this situation. Any insights ...

Troubleshoot: ng-bootstrap Carousel Functionality Issue

While testing the various components on ng-bootstrap, I encountered an issue with getting the carousel to work. Strangely enough, all the other ng-bootstrap components are functioning perfectly. Upon implementing the code from , the result is a blank white ...

Guide to adding information to a table with the help of an "interface" in Angular 6 and utilizing Typescript

Looking for some guidance with Angular as I am just starting out. I am currently trying to send an API request in angular 6 using Typescript. However, I am facing difficulties when it comes to adding data to a table. Check out my code on: Codepen In my p ...

Issue with migrating from Angular version 2.4.10 to 4.0.0

After attempting to update my application from Angular 2.4.10 to 4.0.0, I used the following command: "npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next @angular/forms@next @angular/http@next @angular/pl ...

Every time Chrome on Android returns a keyCode of 229

Here is a snippet of code that I am having trouble with: ... @HostListener('keydown', ['$event']) onKeyDown(evt: KeyboardEvent) { console.log('KeyCode : ' + evt.keyCode); console.log('Which : ' + evt.which); ...